Skip to content
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

Possibility: Use global npm cache #2

Closed
rfay opened this issue Jul 30, 2024 · 2 comments
Closed

Possibility: Use global npm cache #2

rfay opened this issue Jul 30, 2024 · 2 comments

Comments

@rfay
Copy link

rfay commented Jul 30, 2024

I see this in the post-start:

    - exec: bash -ci 'worker=/mnt/ddev_config/diffy-worker-main; ( [ ! -d $worker/node_modules ] && npm install --prefix $worker && chown -R $DDEV_UID:$DDEV_GID $worker/node_modules ) || rm -rf $worker/node_modules'

You're doing an npm install without caching.. but you have ddev-global-cache mounted. And there's a whole npm_config_cache already built and waiting that could be used there (and cached). So you could add the environment variable

    - npm_config_cache=/mnt/ddev-global-cache/npm

And I don't think you'd have to chown or anything. (BTW, I think your chown is from an earlier version of this when you were running the container as root, so that should be removable now.)

@rfay rfay changed the title Possibility: Use cached node stuff Possibility: Use global npm cache Jul 30, 2024
@ygerasimov
Copy link
Contributor

@rfay addressed in #3. Indeed chown is not needed (just tested it). Please confirm I do not need anything else to use cache for npm.

@rfay
Copy link
Author

rfay commented Aug 2, 2024

I guess you're using it! Looks like it's doing fine!

@rfay rfay closed this as completed Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants