Created
October 28, 2018 15:39
-
-
Save kevinmmartins/312ed1bb91df14a75ebee458ac1fa086 to your computer and use it in GitHub Desktop.
Docker compose to a Node application with MongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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