-
Notifications
You must be signed in to change notification settings - Fork 168
Allow locally building multiplatform docker images #6256
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
Conversation
This pull request does not have a backport label. Could you fix it @swiatekm? 🙏
|
|
6f9d971
to
8ebc8ca
Compare
|
@pkoutsovasilis could you test this version and let me know if it cross-builds correctly? I'm curious if you can build it correctly for both platforms at once. Thanks for the help, really appreciate it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! sorry the delay but this one slipped my attention
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
8ebc8ca
to
6005568
Compare
(cherry picked from commit 508271b)
(cherry picked from commit 508271b)
(cherry picked from commit 508271b)
(cherry picked from commit 508271b)
(cherry picked from commit 508271b)
What does this PR do?
It allows building cross-platform docker images. We can already cross-build agent binaries, but for docker images we had a check specifically limiting them to the host architecture. However, buildx makes this pretty straightforward. This PR adds a check for buildx platform availability, and uses it if the host arch doesn't match the requested container image arch.
The cross-built container images gets the arch appended to the tag, so when building
main
for arm64 on a amd64 host, we get the9.0.0-SNAPSHOT-arm64
tag. The native image gets a tag without the suffix, which is a bit inconsistent, but preserves the current behaviour.This doesn't change anything for our CI, which builds arm images on arm hosts, but it makes cross-building locally much simpler.
Why is it important?
It's useful sometimes to be able to locally create a cross-platform manifest. I was troubleshooting some issues in our internal clusters, and wanted the SRE team to test a custom image I built, and had to hack around the build system to make it work.
Checklist
How to test this PR locally
Should build two docker images.