Skip to content

fix: arm64 images contain amd64 binaries due to hardcoded TARGETARCH default#117

Merged
novatechflow merged 1 commit intoKafScale:mainfrom
klaudworks:fix/arm64-docker-cross-compilation
Feb 27, 2026
Merged

fix: arm64 images contain amd64 binaries due to hardcoded TARGETARCH default#117
novatechflow merged 1 commit intoKafScale:mainfrom
klaudworks:fix/arm64-docker-cross-compilation

Conversation

@klaudworks
Copy link
Collaborator

@klaudworks klaudworks commented Feb 27, 2026

Summary

Just tried to deploy this on an ARM machine and there was a amd64 binary inside the docker image.

Per docker/buildx#510 explicit defaults for Dockerfile
platform args shadow the values that buildx injects via --platform.
This causes every platform variant to compile an amd64 binary,
regardless of the target platform.

Solution

Just don't specify a default.

@klaudworks klaudworks marked this pull request as draft February 27, 2026 19:49
@klaudworks klaudworks marked this pull request as ready for review February 27, 2026 19:56
…uilds

All Go-based Dockerfiles declare ARG TARGETARCH=amd64 inside the
builder stage. Per docker/buildx#510, explicit defaults on automatic
platform args shadow the values that buildx injects via --platform.
This causes every platform variant to compile an amd64 binary,
regardless of the target platform.

The CI workflow correctly passes platforms: linux/amd64,linux/arm64
to docker/build-push-action, but the resulting arm64 image layers
contain amd64 Go binaries. Running on arm64 hosts (e.g. AWS Graviton)
fails with: exec format error

The fix removes the =linux and =amd64 defaults. Buildx sets these
args automatically per platform. Without defaults, the injected
values are used correctly.

Affected images: broker, operator, console, proxy, mcp, e2e-client.
@klaudworks klaudworks force-pushed the fix/arm64-docker-cross-compilation branch from aa142ab to 18fd67e Compare February 27, 2026 20:08
Copy link
Collaborator

@PaxMachinaOne PaxMachinaOne left a comment

Choose a reason for hiding this comment

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

Great catch @klaudworks!

@novatechflow novatechflow merged commit 9a5cfcb into KafScale:main Feb 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants