-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
101 lines (95 loc) · 2.64 KB
/
docker-compose.yml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
version: '3.8'
services:
node-ms-mongodb:
image: mongo
container_name: node-ms-mongodb
environment:
- MONGO_INITDB_ROOT_USERNAME=${DATABASE_ADMIN_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${DATABASE_ADMIN_PASSWORD}
- MONGO_INITDB_DATABASE=${DATABASE_NAME}
env_file:
- .env
ports:
- '27017-27019:27017-27019'
volumes:
- ./backend/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- ./backend/mongo-data:/data/db
networks:
- node-ms-network
restart: always
node-ms-mongo-express:
image: mongo-express
container_name: node-ms-mongo-express
ports:
- 8080:8081
environment:
- ME_CONFIG_MONGODB_SERVER=${DATABASE_DOCKER_HOST}
- ME_CONFIG_MONGODB_PORT=${DATABASE_PORT}
- ME_CONFIG_MONGODB_ENABLE_ADMIN=true
- ME_CONFIG_MONGODB_AUTH_DATABASE=${DATABASE_NAME}
- ME_CONFIG_MONGODB_AUTH_USERNAME=${DATABASE_USERNAME}
- ME_CONFIG_MONGODB_AUTH_PASSWORD=${DATABASE_PASSWORD}
- ME_CONFIG_BASICAUTH_USERNAME=${MONGOEXPRESS_LOGIN}
- ME_CONFIG_BASICAUTH_PASSWORD=${MONGOEXPRESS_PASSWORD}
env_file:
- .env
volumes:
- ./backend/sleep.sh:/sleep.sh:ro
command: /bin/sh -c "/sleep.sh && tini -- /docker-entrypoint.sh"
networks:
- node-ms-network
depends_on:
- node-ms-mongodb
restart: always
node-ms-backend:
image: node-ms-backend
container_name: node-ms-backend
build:
context: .
dockerfile: ./backend/Dockerfile
command: /bin/sh -c "/workspace/backend/sleep.sh && exec node src/server.js"
ports:
- 4000:4000
- 9229:9229
env_file: .env
environment:
NODE_ENV: ${development}
APP_PORT: ${APP_PORT}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
DATABASE_HOST: ${DATABASE_DOCKER_HOST}
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_NAME: ${DATABASE_NAME}
volumes:
- ./backend/:/workspace/backend
- /workspace/backend/node_modules
networks:
- node-ms-network
restart: on-failure
depends_on:
- node-ms-mongodb
deploy:
replicas: 1
node-ms-frontend:
image: node-ms-frontend
container_name: node-ms-frontend
build:
context: .
dockerfile: ./frontend/Dockerfile
ports:
- 3000:3000
env_file: .env
environment:
NODE_ENV: ${development}
volumes:
- ./frontend/:/workspace/frontend
- /workspace/frontend/node_modules
networks:
- node-ms-network
restart: on-failure
deploy:
replicas: 1
networks:
node-ms-network:
driver: bridge
name: node-ms-network