Why copy package files before the full source?
COPY . . RUN npm install
- To cache the dependency layer
- To hide the source code
- To skip installing modules
- To reduce network ports
Copying manifests first lets Docker reuse the install layer when only code changes.
Play DevOps ▸