docs
docs copied to clipboard
Development docker-compose will override node_modules
File: language/nodejs/develop.md
In the section Use Compose to develop locally
, a docker-compose file is shown which mounts the app directory into the container to be able to change the code without rebuilding the image. Unfortunately, the node_modules
directory which was created during the build will be overriden as the whole working directory /app
gets mounted. Therefore, I would change the compose from:
version: '3.8'
services:
notes:
build:
context: .
ports:
- 8000:8000
- 9229:9229
environment:
- SERVER_PORT=8000
- CONNECTIONSTRING=mongodb://mongo:27017/notes
volumes:
- ./:/app
command: npm run debug
mongo:
image: mongo:4.2.8
ports:
- 27017:27017
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
volumes:
mongodb:
mongodb_config:
to:
version: '3.8'
services:
notes:
build:
context: .
ports:
- 8000:8000
- 9229:9229
environment:
- SERVER_PORT=8000
- CONNECTIONSTRING=mongodb://mongo:27017/notes
volumes:
- ./:/app
- /app/node_modules
command: npm run debug
mongo:
image: mongo:4.2.8
ports:
- 27017:27017
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
volumes:
mongodb:
mongodb_config: