Page MenuHomePhabricator

Do not bust cached npm-installed dependencies when source files change

Authored by jasonbcox on Feb 3 2021, 21:28.



Similar to D9157, this patch reduces cache busts related to npm packages
and improves rebuild time by ~55% (~70 seconds on my machine).

Depends on D9157

Test Plan

Run this test plan before and after this patch:

docker build --no-cache -t cashtab .

Change a Cashtab source file, then:

docker build -t cashtab .

Sanity check:

docker run -it -p 9000:80 cashtab

Diff Detail

rABC Bitcoin ABC
Lint Not Applicable
Tests Not Applicable

Event Timeline

majcosta added inline comments.
18–20 ↗(On Diff #27523)

you can go even further if you want, just COPY package-lock.json and RUN npm ci

majcosta requested changes to this revision.Feb 3 2021, 21:48
This revision now requires changes to proceed.Feb 3 2021, 21:48
jasonbcox added inline comments.
18–20 ↗(On Diff #27523)

npm ci still uses package.json for reference, as it will error out if package-lock.json does not match package.json

I specifically put npm ci into its own diff in case it generates additional discussion on the impact of reproducible builds (see D9159)

oh, that's perfect, my bad then

This revision is now accepted and ready to land.Feb 3 2021, 22:13