Reduce docker context to improve build times #669
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Use the
.dockerignore
file to exclude large directories and files from the build to reduce the build context.Motivation and Context
I've been using WSL lately which has very poor IO at the moment. The build context we were sending to build was 220MB on my machine (about 100MB in
.git
, 60MB indocs/vendor
, 20MB in aoauth2-proxy
binary I had sitting around).With these added ignores, I reduced the context to 14MB and it now passes the context to docker within a reasonable time frame.
To achieve this, I had to pass the version as a build arg. Which does mean that we can now override the version in the Makefile, which is not ideal but I expect no one to actually use it when publishing releases so it should be fine, right?
How Has This Been Tested?
Manually built the image, ran the image with
--version
to see the builder version passed through correctlyChecklist: