Build multi-arch

This commit is contained in:
Jörn Guy Süß 2025-08-04 11:26:33 +10:00
parent 35221a7495
commit 8df84579a8

View File

@ -1,13 +1,9 @@
# This workflow builds and pushes a Docker image to GitHub Container Registry (ghcr.io) on every push to main.
# This workflow builds and pushes a multi-architecture Docker image to GitHub Container Registry (ghcr.io).
#
# The Docker meta step is required because GitHub repository names can contain uppercase letters, but Docker image tags must be lowercase.
# The docker/metadata-action@v5 normalizes the repository name to lowercase, ensuring the build and push steps use a valid image tag.
#
# Without this normalization, you may encounter errors like:
# ERROR: failed to build: invalid tag "ghcr.io/jgsuess/FHIRFLARE-IG-Toolkit:latest": repository name must be lowercase
# Error: Process completed with exit code 1.
#
# This workflow uses the IMAGE_NAME environment variable set by the Docker meta step to guarantee a valid, lowercase image name.
# This workflow builds for both AMD64 and ARM64 architectures using Docker Buildx and QEMU emulation.
name: Build and Push Docker image
@ -25,6 +21,12 @@ jobs:
- 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:
@ -46,10 +48,11 @@ jobs:
echo "IMAGE_NAME=${{ steps.meta.outputs.tags }}" >> $GITHUB_ENV
fi
- name: Build Docker image
run: |
docker build -f docker/Dockerfile -t ${{ env.IMAGE_NAME }} .
- name: Push Docker image
run: |
docker push ${{ env.IMAGE_NAME }}
- name: Build and push multi-architecture Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE_NAME }}