-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
120 lines (111 loc) · 2.73 KB
/
docker-compose.yaml
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
services:
nginx:
image: nginx:1.23.2
container_name: ${CONTAINER_NAME_NGINX}
restart: always
ports:
- ${NGINX_PORT}:80
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- api_socket_volume:/tmp
- nginx_logs:/var/log/nginx
depends_on:
- api_backend
networks:
- api_net
stop_grace_period: 5s
db:
image: postgis/postgis:17-3.5
container_name: ${CONTAINER_NAME_DB}
restart: always
ports:
- ${POSTGRES_PORT}:5432
volumes:
- postgres_data:/var/lib/postgresql/data
- postgres_logs:/logs_postgres
shm_size: 256mb
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_MAX_CONNECTIONS=200
command:
- --log_destination=stderr
- --logging_collector=on
- --log_directory=./logs_postgres/
- --max_connections=${MAX_CONNECTION}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- api_net
redis:
image: redis:7.4-alpine
container_name: ${CONTAINER_NAME_REDIS}
restart: always
command: >
redis-server
--requirepass ${REDIS_PASSWORD}
healthcheck:
test: [ "CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping" ]
interval: 10s
timeout: 5s
retries: 5
environment:
- REDIS_TIMEOUT=${REDIS_TIMEOUT}
- REDIS_LOGLEVEL=${REDIS_LOGLEVEL}
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- ${REDIS_PORT}:6379
volumes:
- redis_data:/data
networks:
- api_net
api_backend:
build:
dockerfile: Dockerfile
context: ./
container_name: ${CONTAINER_NAME_API}
restart: always
image: ${IMAGE_API}:${VERSION_API}
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PORT=${POSTGRES_PORT}
- JWT_PRIVATE_KEY=${JWT_PRIVATE}
- JWT_PUBLIC_KEY=${JWT_PUBLIC}
command:
- /app/start.sh
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- api_net
volumes:
- api_socket_volume:/tmp
- api_logs:/var/log/refer
env_file:
- .env
stop_grace_period: 10s
volumes:
postgres_data:
name: ${POSTGRES_DATA_VOLUME}
postgres_logs:
name: ${POSTGRES_LOGS_VOLUME}
nginx_logs:
name: ${NGINX_LOGS_VOLUME}
api_logs:
name: ${API_LOGS_VOLUME}
api_socket_volume:
name: ${SOCKET_VOLUME}
redis_data:
name: ${REDIS_VOLUME}
networks:
api_net:
driver: bridge