$ ./guess_the_languageDevOps
DevOps · hard · #110

Why copy package files before the full source?

COPY . .
RUN npm install
  1. To cache the dependency layer
  2. To hide the source code
  3. To skip installing modules
  4. To reduce network ports
Copying manifests first lets Docker reuse the install layer when only code changes.
Play DevOps ▸