fix(container): cross-compile per target platform so linux/arm64 ships an arm64 binary (#382)

The build stage ran natively on $BUILDPLATFORM and make never received a
target arch, so both manifest variants shipped the same amd64 binary
(#379). Pass TARGETOS/TARGETARCH into the build with CGO_ENABLED=0 and
verify each platform variant runs 'pmg version' after push.

Fixes #379


Claude-Session: https://claude.ai/code/session_01E8yrxjqVw7454zByb8kxvD

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Sahil Bansal
2026-07-16 17:21:54 +05:30
committed by GitHub
co-authored by Claude
parent d6709e2fd7
commit 6cd8851679
2 changed files with 9 additions and 1 deletions
+6
View File
@@ -67,4 +67,10 @@ jobs:
.
fi
- name: Verify Image Platform Variants
run: |
for platform in linux/amd64 linux/arm64; do
docker run --rm --platform $platform $REGISTRY/$IMAGE_NAME:latest version
done
+3 -1
View File
@@ -9,7 +9,9 @@ RUN go mod download
COPY . .
RUN make
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} make
FROM debian:11-slim@sha256:e4b93db6aad977a95aa103917f3de8a2b16ead91cf255c3ccdb300c5d20f3015
# Original: debian:11-slim