-
Notifications
You must be signed in to change notification settings - Fork 169
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
Docker+CI: More efficient build #939
Conversation
CI was moved to GHA here: #938 However, it turns out that `buildx` is pretty slow. Improvements in this PR: - Remove `apk add curl` where easily doable - Download `jb` from Github releases rather than building it - Build `tk` exec outside of Docker
|
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.20' |
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.
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' |
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.
The downside of this approach is that there is now a place for specifying the Go version that is not updated by dependabot. Should we perhaps update the Makefile to read the Go version from the Dockerfile or something like that?
@@ -1,21 +1,17 @@ | |||
# download kubectl | |||
FROM golang:1.21.3-alpine as kubectl | |||
RUN apk add --no-cache curl | |||
FROM golang:1.21.3 as kubectl |
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.
Since none of these stages are building code any more, you could drop the golang
images altogether
FROM golang:1.21.3 as build | ||
WORKDIR /app | ||
COPY . . | ||
RUN make static |
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.
Be nicer if this could be kept, so a docker build
continues to work as expected and isn't a two-step thing where if you forget to run make static
you can get an outdated binary in the image.
It should be possible to do this with make
, since it can avoid rebuilding the target if the inputs haven't changed. Would require a change in Makefile
to list the dependencies (*.go
, go.mod
and go.sum
) but shouldn't be too bad to do.
Will close this PR as I do not have the time/desire to get it fixed (repo isn't broken, it's just slightly slow). Pick it up if you wish |
CI was moved to GHA here: #938
However, it turns out that
buildx
is pretty slow when building across other archs. Improvements in this PR:apk add curl
where easily doablejb
from Github releases rather than building ittk
exec outside of DockerResult: 1.5m runtime rather than 10+m