Dockerfile: require a matching lockfile for the web build - #1
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the
|| npm installfallback in the web build stage.Problem
Dockerfile:10readRUN npm ci || npm install. Anynpm cifailure fell through tonpm install, which resolves the version ranges inweb/package.jsonagainst the registry instead of the exact versions pinned inweb/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
The
*also goes, so a missing lockfile fails at the copy rather than as a confusingnpm cierror. Both CI workflows already run a barenpm ci; this makes the container build agree with them.Verification
Full
docker build --no-cacheon the build host, both directions: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).viteto^7.0.0inpackage.jsononly): build now stops atnpm ciwithnpm 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.