Skip to content
Permalink
72a76d246e
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
64 lines (60 sloc) 2.37 KB
version: '2.3'
services:
node:
build:
context: .
args:
- NODE_ENV=development
# you can use legacy debug config or new inspect
# NOTE: if nodemon isn't restarting on changes, you might be on Windows
# which has trouble seeing file changes, so add -L to use legacy polling
# https://github.com/remy/nodemon#application-isnt-restarting
#command: ../node_modules/.bin/nodemon --debug=0.0.0.0:5858
command: ../node_modules/.bin/nodemon --inspect=0.0.0.0:9229 ./bin/www
ports:
- "80:3000"
- "9229:9229"
- "9230:9230"
volumes:
- .:/opt/node_app/app:delegated
# bind-mounting these two files in will let you add packages during development without rebuilding
# for example, to add bower to your app while developing, just install it inside the container
# and then nodemon will restart. Your changes will last until you "docker-compose down" and will
# be saved on host for next build
# NOTE: this won't work on Docker Toolbox (virtualbox) which doesn't bind-mount single files
# docker-compose exec node npm install --save bower
- ./package.json:/opt/node_app/package.json
- ./package-lock.json:/opt/node_app/package-lock.json
# this is a workaround to prevent host node_modules from accidently getting mounted in container
# in case you want to use node/npm both outside container for test/lint etc. and also inside container
# this will overwrite the default node_modules dir in container so it won't conflict with our
# /opt/node_app/node_modules location. Thanks to PR from @brnluiz
- notused:/opt/node_app/app/node_modules
environment:
- NODE_ENV=development
- MONGO_USERNAME=root
- MONGO_PASSWORD=example
- MONGO_HOSTNAME=mongo
- MONGO_PORT=27017
- MONGO_DATABASE_NAME=example-database
depends_on:
mongo:
condition: service_healthy
healthcheck:
disable: true
mongo:
image: mongo
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=example
- MONGO_INITDB_DATABASE=example-database
healthcheck:
test: "[ `echo 'db.runCommand(\"ping\").ok' | mongo localhost/example-database --quiet` ] && echo 0 || echo 1"
interval: 5s
start_period: 10s
timeout: 4s
retries: 3
volumes:
notused: