-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
112 lines (104 loc) · 2.68 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
102
103
104
105
106
107
108
109
110
111
112
# docker-compose.yml
version: "3.8"
x-postgres-env: &postgres-env
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: app
POSTGRES_SSLMODE: disable
PGDATA: /var/lib/postgresql/data/pgdata
services:
postgres:
container_name: postgres
hostname: postgres
image: postgres:12-alpine
restart: on-failure
environment: *postgres-env
networks:
- riotjs-nginx-example-network
expose:
- "5432"
volumes:
- postgres-data:/var/lib/postgresql/data/pgdata
adminer:
container_name: adminer
hostname: adminer
image: adminer:latest
restart: always
expose:
- "8080"
depends_on:
- postgres
networks:
- riotjs-nginx-example-network
backend:
build: ./backend
container_name: backend
hostname: backend
image: riotjs-nginx-example-backend:master
environment:
<<: *postgres-env
PORT: 5000
SSL_CERT_PATH: /etc/letsencrypt/live/primary/cert.pem
SSL_KEY_PATH: /etc/letsencrypt/live/primary/privkey.pem
expose:
- "5000"
depends_on:
- postgres
networks:
- riotjs-nginx-example-network
volumes:
- type: volume
source: certbot-etc
target: /etc/letsencrypt
read_only: true
nginx:
build: ./frontend
command: sh -c '
wait-for.sh adminer:8080 &&
wait-for.sh backend:5000 &&
while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'
container_name: nginx
hostname: nginx
image: riotjs-nginx-example-frontend:master
networks:
- riotjs-nginx-example-network
ports:
- "80:80"
- "443:443"
restart: on-failure
depends_on:
- adminer
- backend
volumes:
- ${PWD}/nginx/prod.nginx.conf:/etc/nginx/conf.d/default.conf
- ${PWD}/nginx/extras.conf:/etc/nginx/extras.conf
- ${PWD}/nginx/cache_expiration.conf:/etc/nginx/cache_expiration.conf
- ${PWD}/scripts/wait-for.sh:/bin/wait-for.sh
- type: volume
source: certbot-etc
target: /etc/letsencrypt
read_only: true
- type: volume
source: certbot-www
target: /var/www/certbot
read_only: true
certbot:
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
container_name: certbot
image: certbot/certbot
networks:
- riotjs-nginx-example-network
volumes:
- certbot-etc:/etc/letsencrypt
- certbot-www:/var/www/certbot
networks:
riotjs-nginx-example-network:
driver: bridge
volumes:
certbot-etc:
name: "certbot-etc"
certbot-www:
name: "certbot-www"
postgres-data: