Skip to content

Dockerfile: require a matching lockfile for the web build - #1

Merged
joyjit merged 1 commit into
mainfrom
dockerfile-npm-ci
Aug 25, 2026
Merged

Dockerfile: require a matching lockfile for the web build#1
joyjit merged 1 commit into
mainfrom
dockerfile-npm-ci

Conversation

@joyjit

@joyjit joyjit commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Closes the || npm install fallback in the web build stage.

Problem

Dockerfile:10 read RUN npm ci || npm install. Any npm ci failure fell through to npm install, which resolves the version ranges in web/package.json against the registry instead of the exact versions pinned in web/package-lock.json. The moment the lockfile drifted, the image stopped being reproducible and started pulling the newest published match — with the build still reporting success.

Change

COPY web/package.json web/package-lock.json ./
RUN npm ci

The * also goes, so a missing lockfile fails at the copy rather than as a confusing npm ci error. Both CI workflows already run a bare npm ci; this makes the container build agree with them.

Verification

Full docker build --no-cache on the build host, both directions:

  • In sync (current tree): builds clean; container starts (listening on :8080), serves the embedded dashboard, and the served JS asset matches the hash and size from the web stage output (index-BUjantV7.js, 468 kB).
  • Drifted on purpose (bumped vite to ^7.0.0 in package.json only): build now stops at npm ci with npm error EUSAGE ... lock file's vite@5.4.21 does not satisfy vite@7.3.6. Previously this would have silently installed vite 7.

Server was run with devices: [] — no access point was contacted.

The web build stage ran `npm ci || npm install`, so any `npm ci`
failure silently fell back to `npm install`. Those differ: `npm ci`
installs the exact versions pinned in web/package-lock.json, while
`npm install` resolves the version ranges in package.json against the
registry and takes the newest match. Once the lockfile drifted out of
sync the image would quietly stop being reproducible and start pulling
whatever had been published most recently, with the build still
reporting success.

Drop the fallback, and drop the `*` from the COPY so a missing
lockfile fails at the copy rather than as a confusing `npm ci` error.
Both CI workflows already run a bare `npm ci`; this makes the
container build agree with them.
@joyjit
joyjit merged commit 9111252 into main Aug 25, 2026
1 of 2 checks passed
@joyjit
joyjit deleted the dockerfile-npm-ci branch August 25, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant