-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
executable file
·87 lines (72 loc) · 2.13 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
version: '3.2'
services:
rest-api:
# build from Dockerfile @ [root]
build:
context: .
# Setup logging for service using default docker logging driver
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "20"
# This api will run on a network called api
networks:
- api
# Mounts the project directory on the host to /home/node/app inside the container,
# allowing you to modify the code without having to rebuild the image.
volumes:
- .:/home/node/app
# Just specify a path and let the Engine create a volume.
# Data present in the base image at the specified mount point will be copied
# over to the new volume upon volume initialization.
# node_modules from this new volume will be used and not from your local dev env.
- /home/node/app/node_modules/
# Expose ports [HOST:CONTAINER}
ports:
- "4040:4040"
# Set environment variables from this file
env_file:
- .env
# Overwrite any env var defined in .env file (if required)
environment:
- MONGO_HOST=mongodb://production/rest-api-app
- DEBUG=rest-api:*
# Link to containers in another service.
# Links also express dependency between services in the same way as depends_on,
# so they determine the order of service startup.
links:
- "db"
# Run healthcheck every 1.5 minutes, if fails 3x in-a-row then notify docker
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4040/api/health-check"]
interval: 1m30s
timeout: 10s
retries: 3
db:
# build from Docker Image: mongo
image: 'mongo:3.4.9'
# Open mongo port
ports:
- '27017:27017'
# mount mongo volume
volumes:
- type: volume
source: mongo
target: /data/db
# Configure networks available on and by which :host" aliases can be used
# on the networks to reference the DB
networks:
api:
aliases:
- production
- development
- test
legacy:
aliases:
- mongo
networks:
api:
legacy:
volumes:
mongo: