Docker build ignores "build" directory to not interfere with it (+parallel build) #750
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.
When developing and testing docker images at the same, I often end up with "mkdir build" error, when building docker image, this PR fixes that.
This PR also enables parallel builds inside docker (make -j) (reduction 3m-> 38s on my machine)
Error reproduction, run from root of the project:
ends up with error:
(removing outside "build" directory or using different one, solves the issue as well)
This happens becuase "build" is transfered as context to "builder" container, which tries to create "build" inside
Maybe it was intended to reause outside "build" direcotry for caching purposes, but then we're risking incoherent, no isolated builds if host environment is different from OS used in Dockerfile.
Extra gain is that with limited context, it speeds up building a little (no need to transfer unused file to container):
vs with
/build
inside.dockerignore
dockerignore file reference: https://docs.docker.com/build/building/context/#dockerignore-files