Skip to content

Build the arm64 image with an arm64 binary - #7

Merged
zhanghaohit merged 2 commits into
mainfrom
fix/arm64-binary
Oct 28, 2026
Merged

zhanghaohit merged 2 commits into
mainfrom
fix/arm64-binary

Conversation

@zhanghaohit

Copy link
Copy Markdown
Collaborator

Problem

The published linux/arm64 image of 4pdosc/hang-watcher contains an amd64 binary, so it cannot start on arm64 nodes. The Dockerfile hardcode GOARCH=amd64; the release workflow builds arm64 under QEMU, where that build still succeeds.

Checked on the registry by reading the ELF header of the entrypoint in each platform of the index (:0.1.27 and :latest): the arm64 entry is x86-64.

Change

  • The Dockerfile take GOARCH from TARGETARCH, which buildx sets to the platform being built. A plain docker build leaves it empty and Go builds for the host, as before.
  • New image-check workflow on pull requests: builds every image for linux/amd64 and linux/arm64 and fails if the binary's ELF machine does not match the platform. Nothing is pushed.

Testing

The check was pushed first on its own, against the unchanged Dockerfile, to confirm it fails on arm64; the fix follows in the next commit and the check passes. Once a release is cut, the published arm64 image should report AArch64.

The release workflow builds linux/amd64 and linux/arm64, but under QEMU an
arm64 build succeeds even when the Dockerfile compiles for amd64, and the
published arm64 image then cannot start. On pull requests, build every
image for both platforms and compare the ELF machine of the binary inside
with the platform. Nothing is pushed.
The Dockerfile hardcoded GOARCH=amd64, so the linux/arm64 image published
by the multi-platform release build contained an amd64 binary and could
not start on arm64 nodes. Take GOARCH from TARGETARCH, which buildx sets
to the platform being built; a plain docker build leaves it empty and Go
builds for the host as before.
@zhanghaohit
zhanghaohit merged commit d8bfb24 into main Oct 28, 2026
5 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.

1 participant