Docker and CI/CD · Junior · Question 18 of 75

Why copy package.json and the lockfile before the rest of the source code?

Explanation

A layer is rebuilt when its inputs change, and so is everything after it. Copying manifests first means editing code doesn't trigger a full reinstall.

Further reading

Problem with a question

Docker and CI/CD · Junior · question 18

Test yourself

Take the Docker and CI/CD · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz