-
Notifications
You must be signed in to change notification settings - Fork 63
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
fix: build all binaries for the target OS/ARCH #49
Conversation
Signed-off-by: Travis Johnson <tsjohnso@us.ibm.com>
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.
Thanks @tjohnson31415!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: njhill, tjohnson31415 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
@@ -116,8 +116,8 @@ ARG TARGETARCH | |||
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ | |||
RUN --mount=type=cache,target=/root/.cache/go-build \ | |||
--mount=type=cache,target=/go/pkg \ | |||
GOOS=${TARGETOS:-linux} \ | |||
GOARCH=${TARGETARCH:-amd64} \ | |||
export GOOS=${TARGETOS:-linux} && \ |
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.
@tjohnson31415 -- I know I missed the review window on this one, but would it not have been more Docker-esque to pull the two variables out into a Dockerfile ENV
declaration?
ENV GOOS=${TARGETOS:-linux} \
GOARCH=${TARGETARCH:-amd64}
RUN --mount=... \
go build -o ...
Only RUN
, COPY
, and ADD
create layers
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.
Well, these two environment variables are configurations only for the single RUN command. If this docker stage was FROM
'd in a final pushed image, I'd think it better avoid the extra env vars created by ENV
, but this is an intermediate stage so 🤷
Motivation
Fix the multi-arch builds so that all binaries are built for the target OS/ARCH. Currently, only the
puller
is built for the target.Modifications
Result