Skip to content

Commit 081b117

Browse files
committed
Build amd64 and arm64 platforms for build image
Signed-off-by: Sascha Grunert <[email protected]>
1 parent d72805c commit 081b117

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,19 @@ jobs:
126126
type=ref,event=pr
127127
type=ref,event=tag
128128
type=sha,format=long
129+
- name: Set up QEMU
130+
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
131+
with:
132+
platforms: linux/amd64,linux/arm64
129133
- name: Build (and push if needed)
130134
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
131135
with:
132136
context: .
133137
file: Dockerfile.build-image
138+
platforms: linux/amd64,linux/arm64
134139
tags: ${{ steps.meta.outputs.tags }}
135140
labels: ${{ steps.meta.outputs.labels }}
136141
push: ${{ github.ref == 'refs/heads/main' }}
137-
# Only load on PR builds
138-
load: ${{ github.ref != 'refs/heads/main' }}
139142
- name: Run container image vulnerability scanner
140143
uses: aquasecurity/trivy-action@d710430a6722f083d3b36b8339ff66b32f22ee55 # 0.19.0
141144
with:

Dockerfile.build-image

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,20 @@ RUN apt-get update && \
2525
ENV USER=root
2626

2727
ARG NIX_VERSION=2.25.0
28-
RUN wget https://nixos.org/releases/nix/nix-${NIX_VERSION}/nix-${NIX_VERSION}-x86_64-linux.tar.xz && \
29-
tar xf nix-${NIX_VERSION}-x86_64-linux.tar.xz && \
28+
29+
RUN \
30+
if [ "$TARGETARCH" = "amd64" ]; then \
31+
export ARCH=x86_64; \
32+
else \
33+
export ARCH=aarch64; \
34+
fi && \
35+
wget https://nixos.org/releases/nix/nix-${NIX_VERSION}/nix-${NIX_VERSION}-${ARCH}-linux.tar.xz && \
36+
tar xf nix-${NIX_VERSION}-${ARCH}-linux.tar.xz && \
3037
groupadd -r -g 30000 nixbld && \
3138
for i in $(seq 1 30); do useradd -rM -u $((30000 + i)) -G nixbld nixbld$i ; done && \
3239
mkdir -m 0755 /etc/nix /nix && \
3340
printf "sandbox = false\nfilter-syscalls = false\n" > /etc/nix/nix.conf && \
34-
nix-${NIX_VERSION}-x86_64-linux/install && \
41+
nix-${NIX_VERSION}-${ARCH}-linux/install && \
3542
ln -s /nix/var/nix/profiles/default/etc/profile.d/nix.sh /etc/profile.d && \
3643
rm -rf nix-*
3744

0 commit comments

Comments
 (0)