Add GitHub Actions workflow to build and push multi-arch Docker image

This commit is contained in:
Abdelkader Boudih 2025-04-13 10:44:10 +01:00
parent 3fcd48cdfc
commit e57a9fd262
No known key found for this signature in database
GPG key ID: B68EDCCB0C8F7912

46
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: Build and Push Docker Image (Multi-Arch)
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image (multi-arch)
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}