Build container

This commit is contained in:
Sabith KS 2024-10-25 12:27:13 -07:00
parent 8d10871531
commit e5c2cd5077

53
.github/workflows/container.yml vendored Normal file
View file

@ -0,0 +1,53 @@
name: Build
on:
workflow_dispatch:
push:
branches:
- "main"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker:
name: Docker build
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.meta.outputs.tags }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: 'linux/amd64,linux/arm64/v8'
tags: ${{ steps.meta.outputs.tags }}
push: true
provenance: false
labels: ${{ steps.meta.outputs.labels }}
build-args: |-
GIT_TAG=${{ github.ref_type == 'tag' && github.ref_name || github.sha }}