fix(docker): pin pnpm via corepack instead of installing the latest - #9
Closed
squarezw wants to merge 1 commit into
Closed
fix(docker): pin pnpm via corepack instead of installing the latest#9squarezw wants to merge 1 commit into
squarezw wants to merge 1 commit into
Conversation
CI went red on 2026-08-05 with nothing changed in the repo:
[ERROR] Cannot verify the identity of the @pnpm/exe.linux-x64 native
binary: it is missing from pnpm-lock.yaml
`RUN npm install -g pnpm` is unpinned, so every build installed whatever pnpm was
newest at that moment. The 08-03 build was fine; by 08-05 pnpm 11 was out, and it
verifies its own native binary against the lockfile — this lockfile was produced by
10.26.2 (lockfileVersion 9.0) and has no such entry.
That failure mode is the nastiest kind: the repo is untouched, the build breaks
anyway, and *when* it breaks depends on someone else's release schedule. "I didn't
change anything" is literally true, which is exactly why it's hard to attribute.
`package.json` already declares `packageManager: pnpm@10.26.2` with a sha512.
corepack reads it, so the version is declared in exactly one place: bumping pnpm
means editing package.json, and the Dockerfile can't drift from it.
Verified by building the builder stage locally: install succeeds and
`pnpm --version` reports 10.26.2 inside the image.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
Author
|
改用另一条路:不动 Dockerfile,改为把 lockfile 升到 pnpm 11(CI 装的就是最新版)。 |
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.
What happened
CI went red on 2026-08-05 with nothing changed in the repo:
RUN npm install -g pnpmis unpinned, so every build installed whatever pnpm was newest at that moment. The 08-03 build was fine; by 08-05 pnpm 11 was out, and it verifies its own native binary against the lockfile — this lockfile came from 10.26.2 (lockfileVersion: '9.0') and has no such entry.This is the nastiest failure mode: the repo is untouched, the build breaks anyway, and when it breaks depends on someone else's release schedule. "I didn't change anything" is literally true, which is exactly why it's hard to attribute — the first instinct is to look at the last commit, and the last commit is innocent.
The fix
package.jsonalready declarespackageManager: pnpm@10.26.2(with a sha512). corepack reads it, so the version lives in exactly one place: bumping pnpm means editingpackage.json, and the Dockerfile can't drift from it.Verified
Built the builder stage locally —
pnpm install --frozen-lockfilesucceeds,next buildcompletes, andpnpm --versioninside the image reports 10.26.2, matchingpackageManager. Not just "the build went green": the pinned version was confirmed in the image.The same one-line problem exists in the private deployment repo and is fixed there identically, so the two Dockerfiles stay byte-identical in that block.
🤖 Generated with Claude Code