Skip to content

[CICD] Build container #2

[CICD] Build container

[CICD] Build container #2

Workflow file for this run

name: Containerize
on:
workflow_dispatch:
pull_request:
branches:
- "main"
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 }}