-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Download and cache dependencies from yarn.lock lockfile #5998
Comments
You can avoid downloading all the packages anew by mounting a cache for the install step RUN \
--mount=type=cache,target=/root/.yarn \
yarn With this cache adding a new dependency will only fetch that one dependency. |
Thanks @merceyz for the advice, I will take a look. Relying on |
I'm back with a prototype! https://gist.github.com/GauBen/8a9847abfbee0138ed2c5fa04812a500 It's currently very experimental but works for my use case
|
Describe the user story
Creating a Docker image of a Yarn-managed monorepo is not really efficient regarding layer caching. As of now there seems to be two possibilities:
This will download the dependencies every time a file is changed
This will properly leverage layer caching but requires hand-maintenance of the docker file
Describe the solution you'd like
This will only re-download the dependencies if yarn.lock is changed, which seems to offer the best of the solutions above, without the hassle
Reference: https://pnpm.io/cli/fetch
Describe the drawbacks of your solution
This solution builds on the current yarn cache clean command, suggesting creating new cache management commands (e.g. download, diff, audit...)
Describe alternatives you've considered
Cache commands should probably all be in yarn core, but this could definitely be a plugin if it can be implemented as a plugin
The text was updated successfully, but these errors were encountered: