generated from yandex-praktikum/client-server-template-with-vite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
121 lines (114 loc) · 2.74 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
113
114
115
116
117
118
119
120
121
# В файле docker-compose — клиент,сервер и база данных.
version: '3.3'
services:
nginx:
container_name: cyb-nginx
image: cyb-nginx
build: ./nginx
restart: always
volumes:
- ./ssl:/ssl
- ./ssl/certbot/conf:/etc/letsencrypt
- ./ssl/certbot/www:/var/www/certbot
links:
- client:client
- server:server
# - pgadmin:pgadmin
ports:
- "80:80"
- "443:443"
networks:
- cyb-net
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
depends_on:
- client
- server
- postgres
# - pgadmin
certbot:
image: certbot/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
volumes:
- ./ssl/certbot/conf:/etc/letsencrypt
- ./ssl/certbot/www:/var/www/certbot
client:
container_name: cyb-client
image: cyb-client
networks:
- cyb-net
restart: always
build:
context: .
dockerfile: ./Dockerfile.client
args:
CLIENT_PORT: ${CLIENT_PORT}
ports:
- '${CLIENT_PORT}:${CLIENT_PORT}'
env_file:
- .env
environment:
- CLIENT_PORT=${CLIENT_PORT}
- SERVER_PORT=${SERVER_PORT}
command: yarn run start:client
depends_on:
- server
server:
container_name: cyb-server
image: cyb-server
networks:
- cyb-net
restart: always
build:
context: .
dockerfile: ./Dockerfile.server
args:
SERVER_PORT: ${SERVER_PORT}
ports:
- '${SERVER_PORT}:${SERVER_PORT}'
env_file:
- .env
environment:
SERVER_PORT: ${SERVER_PORT}
command: yarn run start:server
volumes:
- ./uploads:/app/packages/server/uploads:rw
depends_on:
- postgres
postgres:
container_name: cyb-postgres
image: postgres:15-alpine
networks:
- cyb-net
restart: always
ports:
- '${POSTGRES_LOCAL_PORT}:${POSTGRES_PORT}'
env_file:
- .env
environment:
TZ: "Europe/Moscow"
PG_DATA: /var/lib/postgresql/data/
volumes:
- ./tmp/pgdata:/var/lib/postgresql/data/
# не нужен, но может пригодиться
# pgadmin:
# container_name: cyb-pgadmin
# image: dpage/pgadmin4
# user: root
# networks:
# - cyb-net
# restart: always
# ports:
# - '${PGADMIN_LISTEN_PORT}:${PGADMIN_LISTEN_PORT}'
# env_file:
# - .env
# environment:
# PGADMIN_CONFIG_CONSOLE_LOG_LEVEL: 0
# volumes:
# - ./tmp/pgadmin:/var/lib/pgadmin
# - ./ssl/cert.pem:/certs/server.cert
# - ./ssl/privkey.pem:/certs/server.key
# depends_on:
# - postgres
networks:
cyb-net:
driver: bridge