Repository navigation
[Backport 0.11.x] Cross-compile go-discover instead of building it under QEMU - #410
Merged
suresh-hashicorp merged 1 commit intoNov 4, 2026
Conversation
Pin the go-discover stage to the build platform and cross-compile discover for the target platform. This avoids compiling Go under QEMU emulation for the arm and arm64 image builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
suresh-hashicorp
deployed
to
dockerhub/hashicorpdev
October 30, 2026 07:54 — with
GitHub Actions
Active
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/0.11.x #410 +/- ##
===============================================
Coverage 59.34% 59.34%
===============================================
Files 34 34
Lines 2890 2890
===============================================
Hits 1715 1715
Misses 978 978
Partials 197 197 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Dockerfile cross-compilation backport.
No open issues 🎉
What changed in this PR
Backports #409 to release/0.11.x, speeding up multi-platform image builds by cross-compiling go-discover on the build host instead of compiling under QEMU.
Changes:
- Pins the
go-discoverstage to$BUILDPLATFORM. - Sets target OS, architecture, and ARM variant for cross-compilation.
- Normalizes the binary output path, preserving the final image’s existing copy step and dependency versions.
| File | Description |
|---|---|
| Dockerfile | Cross-compiles go-discover for the target platform and places the binary at the existing copy path. |
Review effort: Balanced
LordAbhishek
approved these changes
Nov 3, 2026
suresh-hashicorp
deleted the
backport/cross-compile-go-discover-0.11.x
branch
November 4, 2026 05:45
This branch was successfully deployed
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.
Changes proposed in this PR:
release/0.11.x.go-discoverstage of theDockerfileto$BUILDPLATFORMand cross-compilediscoverfor the target platform (GOOS,GOARCH, andGOARMfor 32-bit arm), instead of compiling it under QEMU emulation for arm and arm64.go installwrites the binary to/go/bin/<os>_<arch>/, so it is moved to/go/bin/and the finalCOPY --from=go-discover /go/bin/discover /bin/is unchanged.How I've tested this PR:
The cherry-pick applied cleanly with no changes. See #409 for the testing done: the
go-discoverstage built forlinux/amd64,linux/arm64,linux/386,linux/arm/v6,linux/arm/v7andlinux/arm(architecture,GOARMandgo-discover v1.5.0checked withfileandgo version -m), and fullrelease-defaultimages for arm/v7 and arm64 where/bin/discover -hran. CI results for this branch will be added once the checks finish.Build time comparison:
Measured on #409 (this change on
main): the slowest Docker job dropped from about 23.5 minutes (arm default, 1413s) to about 2.4 minutes (131s); arm64 default went from 701s to 136s and arm64 FIPS from 737s to 120s.How I expect reviewers to test this PR:
buildworkflow passes and the ARM Docker jobs take about 2-3 minutes.Artifact Validation Resultspasses after merge (artifact names don't change).Checklist:
PCI review checklist
go-discoverversion are unchanged.)