Skip to content

Commit e1e95ee

Browse files
committed
split build by target arch
1 parent 5b0c335 commit e1e95ee

1 file changed

Lines changed: 38 additions & 11 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,52 @@ jobs:
6969
with:
7070
images: ${{ env.REGISTRY }}/${{ matrix.image.name }}
7171

72-
# Build and push Docker image with Buildx
73-
# https://github.com/docker/build-push-action
74-
- name: Build and push Docker image
75-
id: build-and-push
72+
# Build amd64 image
73+
- name: Build amd64 Docker image
74+
id: build-amd64
7675
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
7776
with:
7877
context: .
7978
file: Containerfile
80-
platforms: linux/amd64,linux/arm64
81-
push: ${{ github.event_name != 'pull_request' }}
82-
tags: ${{ steps.meta.outputs.tags }}
79+
platforms: linux/amd64
80+
push: false
81+
tags: ${{ steps.meta.outputs.tags }}-amd64
8382
labels: ${{ steps.meta.outputs.labels }}
8483
cache-from: type=gha
8584
cache-to: type=gha,mode=max
8685
build-args: |
87-
TARGETARCH
88-
ALTTARGETARCH
89-
OPTTARGETARCH
90-
EXTRARPMS
86+
TARGETARCH=amd64
87+
ALTTARGETARCH=x86_64
88+
OPTTARGETARCH=
89+
EXTRARPMS=
90+
91+
# Build arm64 image
92+
- name: Build arm64 Docker image
93+
id: build-arm64
94+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
95+
with:
96+
context: .
97+
file: Containerfile
98+
platforms: linux/arm64
99+
push: false
100+
tags: ${{ steps.meta.outputs.tags }}-arm64
101+
labels: ${{ steps.meta.outputs.labels }}
102+
cache-from: type=gha
103+
cache-to: type=gha,mode=max
104+
build-args: |
105+
TARGETARCH=arm64
106+
ALTTARGETARCH=aarch64
107+
OPTTARGETARCH=arm64-
108+
EXTRARPMS=gcc python3-devel glibc-devel libxcrypt-devel
109+
110+
# Create and push multi-arch manifest (only if not PR)
111+
- name: Create and push manifest
112+
if: github.event_name != 'pull_request'
113+
run: |
114+
docker buildx imagetools create \
115+
--tag ${{ steps.meta.outputs.tags }} \
116+
${{ steps.meta.outputs.tags }}-amd64 \
117+
${{ steps.meta.outputs.tags }}-arm64
91118
92119
# Sign the resulting Docker image digest.
93120
# This will only write to the public Rekor transparency log when the Docker

0 commit comments

Comments
 (0)