-
-
Notifications
You must be signed in to change notification settings - Fork 963
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
build: Speed up docker build in some setups #1948
Conversation
Could you please link some docs explaining how this works? Thank you :) |
This change is basically a way to add caching to our docker builds on a local machine that runs that build. If you run it on a different machine there is no difference. I also split this into a multi-stage build (this also might speed some things up). Some example doc about this: https://www.docker.com/blog/containerize-your-go-developer-environment-part-2/ |
@@ -1,4 +1,5 @@ | |||
FROM golang:1.16-alpine AS builder | |||
# syntax = docker/dockerfile:1-experimental |
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.
Is this needed?
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.
As far as I know this changes the way dockerfiles are parsed and it's still needed in the current version
@@ -13,13 +14,15 @@ ENV CGO_ENABLED 1 | |||
|
|||
RUN go mod download | |||
|
|||
FROM base 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.
We are using the same image as in the previous step, do we need to or can we leave this out?
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.
it will still work porperly without this
This change adds builder cache in dockerfile. This speeds up the build in some cases.
Related issue(s)
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments