Copy dependency manifests before application code to maximize layer cache reuse.
Section: Common Patterns
Cache dependencies effectively
dockerfile
dockerfile
COPY package*.json ./
RUN npm ci
COPY . .Explanation
A classic Dockerfile optimization for JS apps.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Common Patterns
Use multi-stage build
Build artifacts in one stage and copy only runtime output into the final stage.