DEV Community

Discussion on: Containerize React app with Docker for Production

Collapse
 
bjkeller profile image
Ben Keller

The answer to 2 is that Docker builds images in layers with rebuilds being triggered for all layers after a change has been detected. Since installing dependencies takes time and happens less frequently than code updates, it is better to isolate that step to avoid having dependencies installed every time you tweak your code.