Skip to content

Instantly share code, notes, and snippets.

@kevinmmartins
Created October 28, 2018 15:39
Show Gist options
  • Save kevinmmartins/312ed1bb91df14a75ebee458ac1fa086 to your computer and use it in GitHub Desktop.
Save kevinmmartins/312ed1bb91df14a75ebee458ac1fa086 to your computer and use it in GitHub Desktop.
Docker compose to a Node application with MongoDB
services:
thing-provider-service:
image: node
working_dir: /usr/src/app
volumes:
- ./:/usr/src/app
command: bash -c "npm install && npm start"
ports:
- "3002:3002"
depends_on:
- mongo
mongo:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- ./data/db:/data/db
networks:
default:
external:
name: thing-provider-local-network
# To connect with mongoose use :
mongoose.connect('mongodb://mongo:27017', {
useNewUrlParser: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment