-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: add dockerfile cross-compilation for multi-platform images #1018
base: main
Are you sure you want to change the base?
feat: add dockerfile cross-compilation for multi-platform images #1018
Conversation
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.
For reference, here is the list of multi-platform build arguments. The release GHA is calling make docker-build-and-push
and uses the $(TARGET_PLATFORMS) variable which is set to linux/amd64,linux/arm64
.
I need to test how Tilt behaves with this change.
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.
Have not run it locally yet, some comments/questions inline:
@@ -17,7 +17,8 @@ | |||
# Build the manager binary | |||
ARG builder_image | |||
|
|||
FROM ${builder_image} as builder | |||
#FROM ${builder_image} as builder | |||
FROM --platform=$BUILDPLATFORM ${builder_image} as builder |
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.
where is BUILDPLATFORM
arg defined?
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.
BUILDPLATFORM
is one of the pre-defined build arguments that is available to any build: https://docs.docker.com/build/building/variables/#multi-platform-build-arguments
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.
For some reason, Tilt no longer picks up changes automatically. In my test, a change in a log statement was not reflected in Tilt logs, even though it appeared to re-build the binary.
Signed-off-by: Carlos Salas <[email protected]>
011bb04
to
fbf4894
Compare
What this PR does / why we need it:
Use cross-compilation when building the image with
buildx
. This means that the process does not need to use emulation for the whole build which makes it considerably faster.We can use the existing build arguments (which are globally available):
BUILDPLATFORM
: make the image always native to the machine.TARGETOS
andTARGETARCH
: configure the compiler process for the specific architecture.Which issue(s) this PR fixes:
Fixes #933
Special notes for your reviewer:
I ran a quick test and image building is a few minutes faster after this change.
Checklist: