Skip to content

Commit 62e7c9e

Browse files
committed
separate builds for arm64 and amd64 to provider proper build args
1 parent 28864f8 commit 62e7c9e

1 file changed

Lines changed: 38 additions & 7 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,51 @@ jobs:
6666
with:
6767
images: ${{ env.REGISTRY }}/${{ matrix.image.name }}
6868

69-
# Build and push Docker image with Buildx
70-
# https://github.com/docker/build-push-action
71-
- name: Build and push Docker image
72-
id: build-and-push
69+
# Build amd64 image (no push)
70+
- name: Build amd64 Docker image
71+
id: build-amd64
7372
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
7473
with:
7574
context: .
7675
file: Containerfile
77-
platforms: linux/amd64,linux/arm64
78-
push: true
79-
tags: ${{ steps.meta.outputs.tags }}
76+
platforms: linux/amd64
77+
push: false
78+
tags: ${{ steps.meta.outputs.tags }}-amd64
8079
labels: ${{ steps.meta.outputs.labels }}
8180
cache-from: type=gha
8281
cache-to: type=gha,mode=max
82+
build-args: |
83+
TARGETARCH=amd64
84+
ALTTARGETARCH=x86_64
85+
OPTTARGETARCH=
86+
EXTRARPMS=
87+
88+
# Build arm64 image (no push)
89+
- name: Build arm64 Docker image
90+
id: build-arm64
91+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
92+
with:
93+
context: .
94+
file: Containerfile
95+
platforms: linux/arm64
96+
push: false
97+
tags: ${{ steps.meta.outputs.tags }}-arm64
98+
labels: ${{ steps.meta.outputs.labels }}
99+
cache-from: type=gha
100+
cache-to: type=gha,mode=max
101+
build-args: |
102+
TARGETARCH=arm64
103+
ALTTARGETARCH=aarch64
104+
OPTTARGETARCH=arm64-
105+
EXTRARPMS=gcc python3-devel glibc-devel libxcrypt-devel
106+
107+
# Push combined multi-arch manifest as single tag
108+
- name: Push multi-arch manifest
109+
run: |
110+
docker buildx imagetools create \
111+
--tag ${{ steps.meta.outputs.tags }} \
112+
${{ steps.meta.outputs.tags }}-amd64 \
113+
${{ steps.meta.outputs.tags }}-arm64
83114
84115
# Sign the resulting Docker image digest.
85116
# This will only write to the public Rekor transparency log when the Docker

0 commit comments

Comments
 (0)