🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

docker: arm64 image built with wrong base architecture (BUILDPLATFORM instead of TARGETPLATFORM) #10581

Closed

Description

@alecharp

Description

docker/Dockerfile pins its FROM instruction to --platform=${BUILDPLATFORM}:

FROM --platform=${BUILDPLATFORM} debian:stable-slim

Goreleaser's dockers config builds each architecture via buildx with an explicit --platform build flag (linux/amd64 and linux/arm64, see .goreleaser.yml). BUILDPLATFORM is the platform of the machine running the build (the CI runner), not the platform requested via --platform. On an amd64 CI runner, this means the debian:stable-slim base layer for the image tagged arm64 is actually pulled for linux/amd64, while the updatecli binary copied into it is the arm64 build. The resulting image is tagged/labeled as linux/arm64 but its base OS and system packages are amd64.

Impact

The *-arm64 tags of updatecli/updatecli and ghcr.io/updatecli/updatecli do not contain a consistent arm64 root filesystem, only an arm64 updatecli binary layered on an amd64 base.

Reproduction / evidence

Building docker/Dockerfile with buildx targeting a platform other than the build host's platform shows the mismatch:

$ docker buildx build --platform linux/amd64 -f docker/Dockerfile -t test:amd64 --load .
$ docker inspect test:amd64 --format 'Architecture={{.Architecture}}'
Architecture=amd64
$ docker run --rm --platform linux/amd64 --entrypoint dpkg test:amd64 --print-architecture
arm64

The image manifest reports amd64, but the debian package database inside the image reports arm64 (the build host's architecture) — confirming the base layer was pulled for BUILDPLATFORM, not the requested target.

Fix

Use --platform=${TARGETPLATFORM} instead, so the base image matches the platform actually being built:

FROM --platform=${TARGETPLATFORM} debian:stable-slim

A fix and pull request will follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions