Skip to content

build(docker): compile for the target platform (KG-02) - #48

Merged
PaxMachinaOne merged 1 commit into
mainfrom
kg-02-dockerfile-multiarch
Dec 3, 2026
Merged

PaxMachinaOne merged 1 commit into
mainfrom
kg-02-dockerfile-multiarch

Conversation

@kamir

@kamir kamir commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What

deploy/Dockerfile: the builder stage runs on $BUILDPLATFORM and compiles with GOOS=${TARGETOS} GOARCH=${TARGETARCH} instead of the fixed GOOS=linux GOARCH=amd64. Before, an arm64 image from docker buildx build --platform linux/amd64,linux/arm64 carried an amd64 binary. The distribution builds both platforms.

make docker, the compose files and docker.yml build with BuildKit, which sets TARGETOS/TARGETARCH to the host platform when no --platform is given. Their behaviour does not change.

Checked locally (Docker 27.5.1 with BuildKit, amd64 host)

Check Result
docker build -f deploy/Dockerfile . (as make docker) image linux/amd64, /usr/local/bin/kafgraph is ELF 64-bit, x86-64
builder stage, docker buildx build --platform linux/amd64 ELF 64-bit, x86-64
builder stage, docker buildx build --platform linux/arm64 ELF 64-bit, ARM aarch64; the builder ran natively on amd64

For the builder-stage checks, a copy of the Dockerfile got one extra stage (FROM scratch + COPY --from=builder /app/kafgraph) to export the binary. The Dockerfile in this PR has no such stage.

Not checked yet

The full two-platform build of the KG-02 "done when" (--platform linux/amd64,linux/arm64, both images) has not run. The runtime stage runs apk add/adduser and needs arm64 emulation (QEMU/binfmt), which this host does not have, and the local docker driver cannot build several platforms at once. KG-03 adds that build to CI on GitHub-hosted runners. Until then, KG-02 stays open after the merge.

Ref: KG-02

🤖 Generated with Claude Code

The builder stage forced GOOS=linux GOARCH=amd64, so an arm64 image built
by `docker buildx build --platform linux/amd64,linux/arm64` carried an
amd64 binary. The builder now runs on $BUILDPLATFORM and cross-compiles
with the TARGETOS/TARGETARCH that BuildKit sets from --platform. A plain
`docker build` (make docker, compose) keeps building for the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@PaxMachinaOne PaxMachinaOne 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.

Looks good — files in the low-risk gate, checks green.

@PaxMachinaOne
PaxMachinaOne merged commit a31fa86 into main Dec 3, 2026
2 checks passed
@kamir
kamir deleted the kg-02-dockerfile-multiarch branch December 4, 2026 05:28
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.

2 participants