forked from nitin27may/mean-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
38 lines (36 loc) · 1.26 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
version: "3.8" # specify docker-compose version
# Define the services/containers to be run
services:
express: #name of the second service
build: # specify the directory of the Dockerfile
context: .
dockerfile: dockerfile
container_name: mean_angular_express
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=Thisismysecret
- MONGO_DB_USERNAME=admin-user
- MONGO_DB_PASSWORD=admin-password
- MONGO_DB_HOST=database
- MONGO_DB_PORT=
- MONGO_DB_PARAMETERS=?authSource=admin
- MONGO_DB_DATABASE=mean-contacts
links:
- database
database: # name of the third service
image: mongo:latest # specify image to build container from
container_name: mean_mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=admin-user
- MONGO_INITDB_ROOT_PASSWORD=admin-password
- MONGO_DB_USERNAME=admin-user1
- MONGO_DB_PASSWORD=admin-password1
- MONGO_DB=mean-contacts
volumes:
- ./mongo:/home/mongodb
- ./mongo/init-db.d/:/docker-entrypoint-initdb.d/
- ./mongo/db:/data/db
ports:
- "27017:27017" # specify port forewarding