Repository navigation
fix(templates): keep Corepack's Yarn in the Node runtime image - #4
Conversation
Corepack cached Yarn under root's $HOME at build time, but the runtime image runs with HOME=/tmp, so a `yarn ...` CMD re-downloaded Yarn on every pod start and failed without network. Set COREPACK_HOME in the runtime stage so the download made during `yarn workspaces focus` is baked into the image. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ELojQikqpZ2KVGqjEeNwUe
There was a problem hiding this comment.
I reviewed this and didn't find any bugs. Every path in the repo falls under the CODEOWNERS wildcard, so a code owner still needs to look.
What was reviewed:
COREPACK_HOMEis set beforecorepack enableand the productionyarn workspaces focus, so Yarn is fetched into/usr/local/share/corepackat build time, under root's default 022 umask, and uid 1000 can read it.- With
packageManagerpinned in package.json, Corepack only needs to read that cache at runtime, so the read-only root filesystem shouldn't block ayarn ...CMD. Yarn's own runtime writes still go toHOME=/tmp. - The build stage doesn't set the variable and runs entirely as root, so it isn't affected.
Extended reasoning...
The change adds one ENV line and a three-line comment to the runtime stage of templates/Dockerfile.node, so Corepack caches Yarn somewhere uid 1000 can read. It touches no auth, crypto or data-handling code. It is small and correct as far as I can tell, but CODEOWNERS assigns every path (*) to an owning team, so I deferred instead of approving.
There was a problem hiding this comment.
faraday: this pull request passed the faraday/cage check via the 1h grant in .github/faraday.yml — a listed reviewer approved commit 8a7d09d3 and the Claude Code Review check passed on it. This review is faraday's own approval of that commit so a required-approvals rule is satisfied; it does not count toward faraday's own tally.
Requested by Samuel Attard · Slack thread
This sets
COREPACK_HOME=/usr/local/share/corepackin the runtime stage oftemplates/Dockerfile.node. Without it, Corepack caches Yarn in root's$HOMEat build time, but pods run as uid 1000 withHOME=/tmp, so anyyarn ...CMD (such as the probot one the template suggests) downloads Yarn again on every pod start and fails when it can't reach repo.yarnpkg.com. The migrations of docs-reviewer and trop hit this and fixed it the same way in their own Dockerfiles.Generated by Claude Code