🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
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

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 930af99f-5c56-48e3-a37f-28829e32f3e2

📥 Commits

Reviewing files that changed from the base of the PR and between 37072fa and 6cf076c.

📒 Files selected for processing (1)
  • docker/Dockerfile

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The Dockerfile now selects the target platform for the debian:stable-slim base image instead of the build platform.

Changes

Docker image platform

Layer / File(s) Summary
Select the target platform
docker/Dockerfile
The base image FROM instruction now uses ${TARGETPLATFORM} instead of ${BUILDPLATFORM}.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: olblak

Merge Risk: ⚪ Minimal · up to 341eb

The release images use Debian bases matching their requested architectures, and the release workflows support the Dockerfile’s target-architecture build steps. No actionable merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: using TARGETPLATFORM for the Docker base image.
Description check ✅ Passed The description explains the problem, the change, the linked issue, and the validation results. It does not include the template's checklist, tradeoff, or potential improvement sections, but the core …
Linked Issues check ✅ Passed The change satisfies issue #10581. docker/Dockerfile now uses FROM --platform=${TARGETPLATFORM} debian:stable-slim instead of BUILDPLATFORM. The base image therefore follows the requested target…
Out of Scope Changes check ✅ Passed The pull request changes only the platform variable in the Dockerfile FROM instruction. This change directly addresses the architecture mismatch described in issue #10581. No unrelated change is sho…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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