Skip to content
Discussion options

You must be logged in to vote

Docker caches layers by instruction, and a layer's cache is invalidated as soon as anything it copied changes. If you COPY . . before installing dependencies, every source edit busts the install layer. Copy just the manifest first (package.json/composer.json + lockfile), run the install, then COPY the rest of the source — now deps only reinstall when the manifest actually changes.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Kevinchamplin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant