Skip to content

Commit a62b9f7

Browse files
segmentationfaulteraidankmcalisterankur-arch
authored
Update 130-docker.mdx (#7004)
If we run `npm ci` after `COPY . .`, packages will need to be reinstalled upon every build since `COPY . .` directive invalidates the cache if any source file changes. Having `RUN npm ci` before `COPY . .` ensures that npm packages don't get reinstalled if `packages.json` doesn't change. Co-authored-by: Aidan McAlister <[email protected]> Co-authored-by: Ankur Datta <[email protected]>
1 parent 8df2629 commit a62b9f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/800-guides/130-docker.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ WORKDIR /usr/src/app
333333

334334
COPY package.json package-lock.json ./
335335

336-
COPY . .
337-
338336
RUN npm ci
339337

338+
COPY . .
339+
340340
CMD ["sh", "-c", "npm run db:deploy && npm run dev"]
341341
```
342342

0 commit comments

Comments
 (0)