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

build: Enable Docker Go Cross-compile to improve build times #5223

Merged
merged 3 commits into from
Jan 17, 2025

Conversation

lukaspj
Copy link
Contributor

@lukaspj lukaspj commented Jan 8, 2025

what

When cross-compiling, ARM builds especially are very slow due to virtualisation during the build process.
This change makes the builder stage in the Dockerfile run in the host os and instead cross compile to the target architecture.

why

After this change, the atlantis-image Workflow in my fork went from running in 12 minutes to 4 minutes, so a third of the time it previously took.

tests

no cross-compile

atlantis-image / Build Image (alpine, linux/arm64/v8) (pull_request) Successful in 8m
atlantis-image / Build Image (alpine, linux/amd64) (pull_request) Successful in 2m
atlantis-image / Build Image (alpine, linux/arm/v7) (pull_request) Successful in 11m
atlantis-image / Build Image (debian, linux/arm64/v8) (pull_request) Successful in 9m
atlantis-image / Build Image (debian, linux/amd64) (pull_request) Successful in 2m
atlantis-image / Build Image (debian, linux/arm/v7) (pull_request) Successful in 10m

cross-compile

atlantis-image / Build Image (alpine, linux/arm64/v8) (pull_request) Successful in 4m
atlantis-image / Build Image (alpine, linux/amd64) (pull_request) Successful in 2m
atlantis-image / Build Image (alpine, linux/arm/v7) (pull_request) Successful in 2m
atlantis-image / Build Image (debian, linux/arm64/v8) (pull_request) Successful in 3m
atlantis-image / Build Image (debian, linux/amd64) (pull_request) Successful in 2m
atlantis-image / Build Image (debian, linux/arm/v7) (pull_request) Successful in 2m

references

@lukaspj lukaspj requested review from a team as code owners January 8, 2025 12:17
@lukaspj lukaspj requested review from chenrui333, lukemassa and X-Guardian and removed request for a team January 8, 2025 12:17
@github-actions github-actions bot added the build Relating to how we build Atlantis label Jan 8, 2025
@dosubot dosubot bot added the docker Pull requests that update Docker code label Jan 8, 2025
@lukaspj lukaspj changed the title Cross-compile to improve build times build: Cross-compile to improve build times Jan 8, 2025
Signed-off-by: Lukas Peter Aldershaab <[email protected]>
Signed-off-by: Lukas Peter Aldershaab <[email protected]>
@lukaspj lukaspj force-pushed the fix/improve-arm-build-time branch from b6b8d35 to 1c26a1a Compare January 8, 2025 12:19
@X-Guardian X-Guardian changed the title build: Cross-compile to improve build times build: Enable Docker Go Cross-compile to improve build times Jan 17, 2025
Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

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

Thanks @lukaspj, that's a great improvement! I added comparison timings and a reference link to the PR description.

@X-Guardian X-Guardian merged commit f3ed6c4 into runatlantis:main Jan 17, 2025
45 checks passed
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 17, 2025
lukemassa added a commit to lukemassa/atlantis that referenced this pull request Jan 18, 2025
lukemassa added a commit to lukemassa/atlantis that referenced this pull request Jan 18, 2025
lukemassa added a commit that referenced this pull request Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Relating to how we build Atlantis docker Pull requests that update Docker code lgtm This PR has been approved by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants