mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
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>
32 lines
899 B
Docker
32 lines
899 B
Docker
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm@sha256:5117d68695f57faa6c2b3a49a6f3187ec1f66c75d5b080e4360bfe4c1ada398c AS build
|
|
# Original: golang:1.25-bookworm
|
|
|
|
WORKDIR /build
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
ARG TARGETOS TARGETARCH
|
|
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} make
|
|
|
|
FROM debian:11-slim@sha256:e4b93db6aad977a95aa103917f3de8a2b16ead91cf255c3ccdb300c5d20f3015
|
|
# Original: debian:11-slim
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/safedep/pmg
|
|
LABEL org.opencontainers.image.description="Package Manager Guard to protect against malicious open source packages"
|
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
|
|
|
COPY --from=build /build/bin/pmg /usr/local/bin/pmg
|
|
|
|
ENTRYPOINT ["pmg"]
|