This repository has been archived by the owner on Jan 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
96 lines (90 loc) · 2.95 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
version: '3.7'
services:
# When NGINX proxies a request, it sends the request to a specified proxied
# server (or container), fetches the response, and sends it back to the client.
nginx:
container_name: nginx
build:
context: ./nginx
dockerfile: Dockerfile
target: production
volumes:
# Mounts the 'scripts' folder inside the host on '/opt'.
- './scripts:/opt'
# Mounts the 'letsencrypt' folder inside the host, required for SSL certificates.
- '/etc/letsencrypt:/etc/letsencrypt'
ports:
# Expose the HTTP port to the host
- 80:80
# Expose the HTTPS port to the host
- 443:443
networks:
- services
depends_on:
# First start the gateway-service container before the NGINX container.
- gateway-service
# Portainer allows you to manage your Docker resources: containers, images,
# volumes, networks and more from a web interface.
portainer:
image: portainer/portainer:1.23.0
command: -H unix:///var/run/docker.sock
container_name: portainer
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- './portainer/data:/data'
restart: always
networks:
- services
gateway-database:
image: mysql:5.7.28
volumes:
# Store the MySQL server data outside the container (thus on the host).
- './gateway/database/data:/var/lib/mysql'
# Will load the init.sql file on a fresh MySQL server instance.
- './gateway/database/init.sql:/docker-entrypoint-initdb.d/init.sql'
restart: always
networks:
# Make this service discoverable on the 'services' network.
- gateway-service
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: gluten
MYSQL_USER: gluten
MYSQL_PASSWORD: gluten
gateway-cache:
image: redis:5.0.7
volumes:
# Store the Redis store data outside the container (thus on the host).
- './gateway/cache:/data'
restart: always
networks:
- gateway-service
gateway-service:
build: ./gateway/service
volumes:
# Mounts the 'scripts' folder inside the host on '/opt'.
- './scripts:/opt'
# Store the logs outside the container (thus on the host).
- './gateway/service/logs:/usr/src/app/logs'
networks:
# Make this service discoverable on the 'services' network.
- services
# Get access to the database and cache.
- gateway-service
links:
# This allows the access to the gateway-cache using hostname 'cache'.
- gateway-cache:cache
# This allows the access to the gateway-cache using hostname 'database'.
- gateway-database:database
depends_on:
- gateway-cache
- gateway-database
environment:
MYSQL_HOST: database
NODE_ENV: production
REDIS_HOST: cache
networks:
# Network that links all services with NGINX.
services: {}
# Dedicated network to seperate the dependencies of the gateway-service.
gateway-service: {}