Page MenuHomePhabricator

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

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

Details

Summary

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

Repository
rABC Bitcoin ABC
Branch
cachebust-cashtab-npm
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15109
Build 30168: Build Diffcashtab-tests
Build 30167: arc lint + arc unit

Event Timeline

majcosta added inline comments.
web/cashtab/Dockerfile
18–20

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.
web/cashtab/Dockerfile
18–20

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