feat: add ARM64 support for Docker images and binary releases (#159)#307
feat: add ARM64 support for Docker images and binary releases (#159)#307Makennsky wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces new Makefile targets for ARM64 distribution and multi-architecture Docker builds. Feedback focuses on improving build reliability by adding missing dependencies, standardizing package paths, and ensuring Docker images are correctly tagged and exported.
| dist-arm64: clean | ||
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=vendor -ldflags "-X github.com/moov-io/achgateway.Version=${VERSION}" -o bin/achgateway-linux-arm64 ./cmd/achgateway/ |
There was a problem hiding this comment.
The dist-arm64 target should include update as a dependency to ensure the vendor directory is populated before the build starts. Additionally, for consistency with the build target (line 30), it is recommended to use the full package path instead of a relative path.
Note: This target uses CGO_ENABLED=0, whereas the AMD64 dist target (line 100) uses CGO_ENABLED=1. This inconsistency can lead to differences in binary behavior (e.g., networking/DNS resolution). Consider standardizing CGO_ENABLED across distribution targets if possible.
dist-arm64: update clean
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=vendor -ldflags "-X github.com/moov-io/achgateway.Version=${VERSION}" -o bin/achgateway-linux-arm64 github.com/moov-io/achgateway/cmd/achgateway
| docker-multiarch: update | ||
| docker buildx build --platform linux/amd64,linux/arm64 --build-arg VERSION=${VERSION} -t moov/achgateway:${VERSION} -f Dockerfile . |
There was a problem hiding this comment.
The docker-multiarch target is missing the latest tag, which is present in the standard docker target (line 53). Adding it ensures consistency across image builds. Also, including the --pull flag ensures the base image is up to date.
Furthermore, docker buildx build with multiple platforms requires an explicit output destination like --push to a registry or a custom exporter. Without such a flag, the multi-arch manifest and images are not saved to the local Docker daemon's image list.
docker-multiarch: update
docker buildx build --pull --platform linux/amd64,linux/arm64 --build-arg VERSION=${VERSION} -t moov/achgateway:${VERSION} -t moov/achgateway:latest -f Dockerfile .
Changes
dist-arm64anddocker-multiarchMakefile targetsWhy Are Changes Being Made
Adds ARM64 support as requested by @adamdecaf in #159. Uses GitHub's native ARM64 runners for fast builds instead of slow QEMU emulation.