Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use native go cross-compiling #260

Merged
merged 1 commit into from
Apr 25, 2022
Merged

use native go cross-compiling #260

merged 1 commit into from
Apr 25, 2022

Conversation

deitch
Copy link
Contributor

@deitch deitch commented Apr 24, 2022

We call the builds by passing --platforms to the docker buildx build, whether directly or via the GitHub action docker/build-push-action.

Either way, this causes it to run every command under qemu, so that non-native builds take about 4-5x as long as the native ones. See a typical build and issue #257 .

This proposes to fix the biggest problem, i.e. those emulated builds. Instead of emulating the entire process, this will run the actual build (as well as go mod download and every other step except for image assembly) on the native platform, but cross-compiling.

Local tests show that the result is that building for both native and alternate platforms are within a few percentage points of each other. We will let CI run here and see what it reports.

Signed-off-by: Avi Deitcher <avi@deitcher.net>
@deitch
Copy link
Contributor Author

deitch commented Apr 24, 2022

Build took 5.5 minutes, vs 20-25 mins before. I think we can consider this a win.

Copy link
Member

@displague displague left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple and large optimizations are the best!

@deitch deitch merged commit cdbe540 into master Apr 25, 2022
@deitch deitch deleted the better-cross-compile branch April 25, 2022 19:43
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.

None yet

2 participants