-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: Simpler Docker build #5057
Conversation
alexec
commented
Feb 9, 2021
•
edited
Loading
edited
Build | Before | After |
---|---|---|
Docker Build | 1h | 45m |
CI | 13m | 17m |
Signed-off-by: Alex Collins <alex_collins@intuit.com>
@@ -1,10 +1,21 @@ | |||
# Prevent vendor directory from being copied to ensure we are not not pulling unexpected cruft from | |||
# a user's workspace, and are only building off of what is locked by dep. | |||
*.iml |
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.
while these files are small, they can result in invalidating the Docker caches, forcing build steps to be re-run
|
||
ARG IMAGE_OS=linux | ||
ARG DOCKER_CHANNEL=stable |
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.
ARGs can and should go before the first FROM
Dockerfile
Outdated
tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \ | ||
rm docker.tgz | ||
# https://blog.container-solutions.com/faster-builds-in-docker-with-go-1-11 | ||
WORKDIR /go/src/github.com/argoproj/argo |
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.
classic cache speed up technique
FROM debian:10.7-slim as argoexec-base | ||
|
||
ARG IMAGE_OS=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.
we don't need this because we use `docker buildx --platform linux/amd64'
|
||
#################################################################################################### | ||
|
||
FROM node:14.0.0 as argo-ui | ||
|
||
ADD ["ui", "ui"] | ||
ADD ["api", "api"] | ||
COPY ui/package.json ui/yarn.lock ui/ |
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.
another classic speed up technique
COPY . . | ||
# check we can use Git | ||
RUN git rev-parse HEAD | ||
RUN --mount=type=cache,target=/root/.cache/go-build make dist/workflow-controller |
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.
this is a buildx way to do build caching, I'm not 100% sure it works, so we may want to remove later on
COPY --from=argo-build --chown=8737 /go/src/github.com/argoproj/argo/argo-server.key argo-server.key | ||
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/argo-${IMAGE_OS}-* /bin/argo | ||
|
||
COPY hack/ssh_known_hosts /etc/ssh/ |
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.
no longer depend on argoexec
DOCKER_PUSH := false | ||
|
||
# VERSION is the version to be used for files in manifests and should always be latest uunlesswe are releasing | ||
# we assume HEAD means you are on a tag | ||
ifeq ($(findstring release,$(GIT_BRANCH)),release) | ||
VERSION := $(GIT_TAG) | ||
DEV_IMAGE := false |
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.
no longer need dev images, standard build is fast enough
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
This is actually a 3m slower to run tests CI, but is faster to start-up locally. |