Every line in a Dockerfile is a layer. If you change a file, all subsequent layers are rebuilt. This is slow.
The Pro Strategy: Always copy your dependency files (package.json, .csproj) BEFORE your source code. This ensures that ‘npm install’ or ‘dotnet restore’ is only re-run if dependencies change, not every time you edit a comment.
