Optimize Dockerfile for faster rebuilds#808
Conversation
|
And what if the dependencies changed? I had to rebuild the image earlier today because new dependencies were added, maybe that's not the intended way, is it? |
|
If the dependencies change, the pipfile/pipfile.lock file needs to change. When either of those files change, the cached layer will not be used and the layer will be built the same way it is today. |
MarkKoz
left a comment
There was a problem hiding this comment.
This has no benefits in CI because the agent is new for every build, thus does not have previous layers cached. Furthermore, contributors using Docker would only need to build this image if dependencies change (cause their source code on the host gets mounted inside the container), so this change doesn't benefit them.
Still, I don't see why not. Maybe it will save someone time somehow.
|
Yeah, I'm pretty sure CI won't leverage caching. GitLab can do that, but not sure about ADO. Mostly it's beneficial for local development :) |
This change optimizes the docker build so that a cached layer for installing dependencies can be used, instead of installing dependencies every build.