chore: exclude .pnpm-store from Docker build context - #3313
Conversation
On local builds the .pnpm-store directory is not excluded from the build context. Since it's never referenced by the Dockerfile RUN --mount=type=cache uses its own in-container store path, and it gets shipped to the daemon on every build for no benefit. Adding .pnpm-store to .dockerignore cuts build context size by over 1gb with no change to build output.
📝 WalkthroughWalkthroughThe Docker ignore configuration now excludes ChangesDocker context configuration
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hello, What does the https://github.com/pnpm/pnpm/blob/main/pnpm/crates/config/src/defaults.rs#L77 |
|
Generally, you are right and on any CI build or even a lot of local builds .pnpm-store should not be carried over, however since my home folder and project folder live on different disks/volumes, pnpm can't hardlink the files properly, so it falls back to putting the store inside the project folder instead. Whether it's worth fixing a niche case is a different matter, but either way I don't think there is any downside to explicitly excluding .pnpm-store so it's never copied over.
|
Description
On local builds the .pnpm-store directory is not excluded from the build context. Since it's never referenced by the Dockerfile RUN --mount=type=cache uses its own in-container store path, and it gets shipped to the daemon on every build for no benefit. Adding .pnpm-store to .dockerignore cuts build context size by over 1gb with no change to build output.
How Has This Been Tested?
Local Docker build was run successfully with image output size reduced by 1.2gb
Screenshots / Logs (if applicable)
N/A
Checklist:
pnpm buildpnpm i18n:extract