I'm a full stack web developer who has been freelancing for the last 20 years. I write about everything from development to production and also have video courses on my site!
For development I almost always volume mount .:/app which would mount in the current directory (the source code) into the /app path in the container which is a general place I use to keep my source code in the container, but in your case the /app part might vary.
I don't worry about node_modules/ because at Docker build time I configure yarn to install its dependencies into /node_modules inside the Docker image instead of node_modules/ which is relative to /app.
You can do that with a .yarnrc file by putting in --modules-folder /node_modules.
In other words, I don't end up with 42 billion node dependencies on my dev box through the volume because they're never mounted.
The same strategy applies with other language package managers that install dependencies to relative folders by default (such as Composer with PHP and Mix with Elixir).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For development I almost always volume mount
.:/app
which would mount in the current directory (the source code) into the/app
path in the container which is a general place I use to keep my source code in the container, but in your case the/app
part might vary.I don't worry about
node_modules/
because at Docker build time I configure yarn to install its dependencies into/node_modules
inside the Docker image instead ofnode_modules/
which is relative to/app
.You can do that with a
.yarnrc
file by putting in--modules-folder /node_modules
.In other words, I don't end up with 42 billion node dependencies on my dev box through the volume because they're never mounted.
The same strategy applies with other language package managers that install dependencies to relative folders by default (such as Composer with PHP and Mix with Elixir).