-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
41 lines (38 loc) · 1.57 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
version: '3.1'
services:
mongo:
image: mongo
restart: always
ports:
- 27017:27017
environment:
# creating a database when container is initialised
MONGO_INITDB_DATABASE: defaultDB
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
volumes:
- mongo-db:/data/db
- mongo-configdb:/data/configdb
# create a new user admin password and give it readWrite access to defaultDB
- ./mongo/001_users.js:/docker-entrypoint-initdb.d/001_users.js:ro
my-app:
build:
context: .
dockerfile: Dockerfile
depends_on:
- mongo
volumes:
#Use the local app folder, but use a named volume for node_modules. This avoids conflicts with the local system.
- ./:/app
ports:
- 8888:8888
environment:
- NODE_ENV=production
- PORT=8888
- app_jwtPrivateKey=testPrivateKey
- app_mongodbUrl=mongodb://admin:password@mongo:27017/defaultDB
command: "npm start"
volumes:
#Configure shared volumes to be used in the services above.
mongo-db:
mongo-configdb: