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

empty node_modules folder gets created as root by bind mount if it doesn't already exist #115

Open
CorruptBandit opened this issue Apr 29, 2024 · 0 comments

Comments

@CorruptBandit
Copy link

To be able to do dev both inside and out of Docker the node modules folders need to be completely separate to avoid clashing.

The code that creates the directory:

   volumes:
      - .:/opt/node_app/app

This only happens when the directory doesn't exist yet, and with the other code in the compose it will prevent the folder from being populated by content from the Docker container (which is good)

The problem is that the empty gets created as root, meaning npm installs outside of docker fail.

The simplest workarounds are to either create the directory before ever running docker compose up or don't use . for the volume and instead explicitly specify the dir that the source code for the app is in.

Is there a nicer way to handle this?

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

1 participant