fix: avoid perm errors by making node_modules access unprivileged
Allows packages to be installed via docker-compose exec <service> npm i <package>
closes #91. See #49 for the original discussion.
May also affect #28 by removing the need for individual file mounts as mentioned in the comments there, but it needs to be tested on Docker Toolbox/hyper-v to be sure.
Something to keep in mind is that this change makes the named volume (notused in compose) persist the results of the command above. removing volumes when needed (docker-compose down -v), or mounting an unnamed volume since it behaves like tmpfs mounts for our purposes (:/opt/node_app/app/node_modules), solves this case.
Also apologies for the late PR, life gets in the way :smile:
OK thanks, I'll do some testing.
I'm sorry this has been a year, but I don't think it works as intended.
I've not seen permissions problems with the existing setup. Do you have a working example that I can reproduce your permissions error. Everything is installed/copied as node user in the Dockerfile, so I'm not sure what the original issue could be.
In this PR, the real node_modules is moved up a directory after install, effectively making it no different than the main branch it's changing. Then this PR changes the npm install example to not install modules in the proper path.