@@ -66,20 +66,55 @@ 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+ id : manifest
110+ run : |
111+ docker buildx imagetools create \
112+ --tag ${{ steps.meta.outputs.tags }} \
113+ ${{ steps.meta.outputs.tags }}-amd64 \
114+ ${{ steps.meta.outputs.tags }}-arm64
115+ # Get the digest of the created manifest
116+ DIGEST=$(docker buildx imagetools inspect ${{ steps.meta.outputs.tags }} --format '{{.Manifest.Digest}}')
117+ echo "digest=${DIGEST}" >> $GITHUB_OUTPUT
83118
84119 # Sign the resulting Docker image digest.
85120 # This will only write to the public Rekor transparency log when the Docker
90125 env :
91126 # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
92127 TAGS : ${{ steps.meta.outputs.tags }}
93- DIGEST : ${{ steps.build-and-push .outputs.digest }}
128+ DIGEST : ${{ steps.manifest .outputs.digest }}
94129 # This step uses the identity token to provision an ephemeral certificate
95130 # against the sigstore community Fulcio instance.
96131 run : echo "${TAGS}" | xargs -I "{}" cosign sign --yes "{}@${DIGEST}"
0 commit comments