fix(docker): use TARGETPLATFORM for base image by alecharp · Pull Request #10584 · updatecli/updatecli · GitHub
Skip to content

fix(docker): use TARGETPLATFORM for base image - #10584

Merged
olblak merged 2 commits into
updatecli:mainfrom
alecharp:fix/docker-target-platform
Sep 24, 2026
Merged

olblak merged 2 commits into
updatecli:mainfrom
alecharp:fix/docker-target-platform

Conversation

@alecharp

@alecharp alecharp commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #10581

Why

Goreleaser's buildx docker builds set --platform per architecture
(see .goreleaser.yml), but the Dockerfile pinned FROM to
BUILDPLATFORM (the build host's architecture). The debian base
layer therefore always matched the CI runner instead of the
requested target, so multi-arch images (e.g. the arm64 tag built on
an amd64 runner) shipped a base OS of the wrong architecture while
only the copied updatecli binary matched the intended target.

Testing

Built the Dockerfile locally with buildx targeting a platform other
than the build host's, both before and after the change:

$ docker buildx build --platform linux/amd64 -f docker/Dockerfile -t test:old --load .   # BUILDPLATFORM
$ docker inspect test:old --format 'Architecture={{.Architecture}}'
Architecture=amd64
$ docker run --rm --platform linux/amd64 --entrypoint dpkg test:old --print-architecture
arm64   # mismatch: base OS is the build host's arch, not the requested target

$ docker buildx build --platform linux/amd64 -f docker/Dockerfile -t test:new --load .   # TARGETPLATFORM (this PR)
$ docker inspect test:new --format 'Architecture={{.Architecture}}'
Architecture=amd64
$ docker run --rm --platform linux/amd64 --entrypoint dpkg test:new --print-architecture
amd64   # matches the requested target

With this change, dpkg --print-architecture inside the built image
matches the --platform value passed to buildx, confirming the base
image now tracks the requested target platform instead of the build
host.

Summary by CodeRabbit

  • Build Improvements
    • Docker images now use the intended target platform during multi-platform builds, helping ensure the resulting image matches the platform it is built for.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

@olblak olblak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix

@olblak olblak added the bug Something isn't working label Sep 24, 2026
@olblak
olblak merged commit 7fe4cac into updatecli:main Sep 24, 2026
8 checks passed
@alecharp
alecharp deleted the fix/docker-target-platform branch September 24, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants