forked from nitin27may/mean-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.nginx.yml
More file actions
59 lines (56 loc) · 2.02 KB
/
Copy pathdocker-compose.nginx.yml
File metadata and controls
59 lines (56 loc) · 2.02 KB
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
# Docker Compose file to run as production mode for a MEAN stack application with Nginx as a load balancer.
services:
angular: # name of the first service
build: # specify the directory of the Dockerfile
context: frontend
args:
- API_URL=/api
container_name: ${ID_PROJECT:-mean}_angular
restart: always
# ports:
# - "4000:4000" # specify port forewarding
environment:
- NODE_ENV=dev
express: #name of the second service
build: api # specify the directory of the Dockerfile
container_name: ${ID_PROJECT:-mean}_express
restart: always
# ports:
# - "3000:3000" #specify ports forewarding
# Below database enviornment variable for api is helpful when you have to use database as managed service
environment:
- SECRET=${SECRET}
- MONGO_DB_USERNAME=${MONGO_DB_USERNAME}
- MONGO_DB_PASSWORD=${MONGO_DB_PASSWORD}
- MONGO_DB_HOST=${MONGO_DB_HOST}
- MONGO_DB_PORT=${MONGO_DB_PORT}
- MONGO_DB_PARAMETERS=${MONGO_DB_PARAMETERS}
- MONGO_DB_DATABASE=${MONGO_DB_DATABASE}
- EXPRESS_PORT=${MONGO_DB_DATABASE}
links:
- database
database: # name of the third service
image: mongo:latest # specify image to build container from
container_name: ${ID_PROJECT:-mean}_mongo
restart: always
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_DB_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_DB_PASSWORD}
- MONGO_DB_USERNAME=${MONGO_DB_USERNAME}
- MONGO_DB_PASSWORD=${MONGO_DB_PASSWORD}
- MONGO_DB=${MONGO_DB_DATABASE}
- MONGO_INITDB_DATABASE=${MONGO_DB_DATABASE}
volumes:
- ./mongo/init-db.d/:/docker-entrypoint-initdb.d/
- ./mongo/db:/data/db
ports:
- "27017:27017" # specify port forewarding
nginx: #name of the fourth service
build: loadbalancer # specify the directory of the Dockerfile
container_name: ${ID_PROJECT:-mean}_nginx
restart: always
ports:
- "80:80" #specify ports forewarding
links:
- express
- angular