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

Support ARM64 and simplify GitHub Action for building OCI images #37

Merged
merged 13 commits into from
Apr 28, 2023

Conversation

Matthew-Beckett
Copy link
Collaborator

This PR adds QEMU and configures docker buildx to use an ARM64 emulation on AMD64 to build ARM64 targeted images on AMD64 runners.

@Matthew-Beckett
Copy link
Collaborator Author

Can I recommend due to the length of job we also configure a concurrency expression?

https://docs.github.com/en/actions/using-jobs/using-concurrency

@jodevsa
Copy link
Owner

jodevsa commented Apr 26, 2023

Can I recommend due to the length of job we also configure a concurrency expression?

Are you referring to lowering the number of parallel jobs running at the same time?

@jodevsa
Copy link
Owner

jodevsa commented Apr 26, 2023

looks like the slowness is mainly coming from QEMU's emulation.

We can disable arm64 builds on PRs and only enable it for master just like how they did it here: DSpace/DSpace#8315

@jodevsa jodevsa force-pushed the feature/arm-build-fix branch 2 times, most recently from 731c2ce to 4c858dc Compare April 28, 2023 12:22
@Matthew-Beckett
Copy link
Collaborator Author

looks like the slowness is mainly coming from QEMU's emulation.

We can disable arm64 builds on PRs and only enable it for master just like how they did it here: DSpace/DSpace#8315

I like this solution, happy to implement.

@Matthew-Beckett
Copy link
Collaborator Author

Can I recommend due to the length of job we also configure a concurrency expression?

Are you referring to lowering the number of parallel jobs running at the same time?

No, concurrency will group jobs together which are the same and can allow push to cancel previous in-process jobs in order to save runner minutes.

@jodevsa
Copy link
Owner

jodevsa commented Apr 28, 2023

@Matthew-Beckett I did some tweaks like reordering the layers to achieve more caching. Somehow the builds now finish in 2-3 minutes for both architectures. Can you please review my changes and check if we are really building both platforms :D because it sounds too good to be true.

@Matthew-Beckett
Copy link
Collaborator Author

@Matthew-Beckett I did some tweaks like reordering the layers to achieve more caching. Somehow the builds now finish in 2-3 minutes for both architectures. Can you please review my changes and check if we are really building both platforms :D because it sounds too good to be true.

It would appear it is in fact too good to be true, when checking the package in the GitHub UI you can see that the ARM and AMD64 commit hashes have diverged and are not on the same commit, also in the logs of the last run I don't see any linux/arm64 docker build only linux/amd64.

I don't think it's working properly.

https://github.com/jodevsa/wireguard-operator/pkgs/container/wireguard-operator%2Fmanager/89235169?tag=pr-38

@jodevsa
Copy link
Owner

jodevsa commented Apr 28, 2023

@Matthew-Beckett I got it working!

I reworked the builds. latest run only took 6 minutes!

The speed bump is coming from not using emulation to build arm64 binaries. Currently i'm building the arm64 binaries over amd64 images. the changes are inspired from: https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/

@Matthew-Beckett
Copy link
Collaborator Author

LGTM!

@jodevsa jodevsa merged commit 2b4e51f into jodevsa:main Apr 28, 2023
2 checks passed
@jodevsa
Copy link
Owner

jodevsa commented May 7, 2023

fixes #20

@Matthew-Beckett Matthew-Beckett mentioned this pull request May 11, 2023
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