Skip to content

Commit 187751b

Browse files
authored
feat(ci): Enable multi-arch Docker image builds and conditional login (#160)
* feat(ci): Enable multi-architecture Docker image builds and conditional login This change enhances our Docker image building process within the GitHub Actions workflow by: Introducing Multi-Architecture Support: The workflow now builds Docker images for multiple CPU architectures (currently configured for linux/amd64 and linux/arm64 via the PLATFORMS environment variable). This allows our images to run natively on a wider range of hardware, including common cloud instances (like AWS Graviton), Apple Silicon (M1/M2/M3) via Docker Desktop, Raspberry Pis, and other ARM-based devices. This is achieved by: Adding docker/setup-qemu-action for cross-architecture emulation. Configuring docker/build-push-action with the platforms parameter. Optimizing Docker Registry Login: The docker/login-action step is now conditional. It will only execute if the workflow event is not a pull_request. This means we only attempt to log in to the container registry when we intend to push the image (e.g., on merges to main or tag pushes), not during pull request validation builds. This saves time and avoids unnecessary authentication attempts. * Remove qemu since it's too slow * fix os name * clean file
1 parent ca14883 commit 187751b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/docker-build-push.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ env:
1414

1515
jobs:
1616
build-and-push:
17-
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
include:
20+
- os: ubuntu-latest
21+
- os: ubuntu-24.04-arm
22+
runs-on: ${{ matrix.os }}
1823
permissions:
1924
contents: read
2025
packages: write
@@ -27,6 +32,7 @@ jobs:
2732
uses: docker/setup-buildx-action@v3
2833

2934
- name: Log in to the Container registry
35+
if: github.event_name != 'pull_request'
3036
uses: docker/login-action@v3
3137
with:
3238
registry: ${{ env.REGISTRY }}
@@ -57,4 +63,4 @@ jobs:
5763
tags: ${{ steps.meta.outputs.tags }}
5864
labels: ${{ steps.meta.outputs.labels }}
5965
cache-from: type=gha
60-
cache-to: type=gha,mode=max
66+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)