Add multi-platform Docker build support via setup-buildx target#91
Merged
Conversation
Without QEMU binfmt handlers, arm64 layers fail with "exec format error" on amd64 build hosts. setup-buildx target runs tonistiigi/binfmt --install all before any docker compose build. https://claude.ai/code/session_01FkpycXAXX1oB5Ut9TSZWDU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
setup-buildxMakefile target that registers QEMU binfmt handlers for multi-platform (amd64/arm64) Docker builds, and makes it a prerequisite forbuild,prod, anddevtargets to ensure cross-platform compatibility is initialized before any image builds.Changes
setup-buildxtarget: Runsdocker run --rm --privileged tonistiigi/binfmt --install allto register QEMU binary format handlers, enabling seamless multi-platform image builds on non-native architectures.PHONYdeclaration: Addedsetup-buildxto the list of phony targetssetup-buildxa prerequisite: All image-building targets (build,prod,dev) now depend onsetup-buildxto guarantee multi-platform support is available before Docker Compose operationsImplementation Details
This change ensures that when developers or CI/CD pipelines run
make build,make prod, ormake dev, the QEMU binfmt handlers are automatically registered first. This is essential for the project's multi-platform Docker Compose setup (amd64/arm64) to work correctly, particularly when building on non-native architectures like ARM64 systems building amd64 images or vice versa.The
tonistiigi/binfmtimage is the standard tool for this purpose and is run with--privilegedto allow kernel module registration.https://claude.ai/code/session_01FkpycXAXX1oB5Ut9TSZWDU