fix: use docker cache best practices in examples #1673
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.
The whole purpose of the
turbo prune --docker
is to use docker caching best practices while the Docker examples do not follow these bests practices.Plus, I believe that the first stage of the Dockerfile is wrong as it copies the whole project and defeats the entire purpose of the caching because the first layer never gets cached. I believe the most optimized solution is to run the
turbo prune
before thedocker build
on the machine that runs thedocker build
and set theout
directory as the docker build context.I understand that showing this approach may not be possible in the example, so I suggest we add a comment to the first stage with the above explanation.