-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
81 lines (77 loc) · 1.98 KB
/
Copy pathdocker-compose.yml
File metadata and controls
81 lines (77 loc) · 1.98 KB
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
services:
bot:
build:
context: .
dockerfile: Dockerfile
image: qr-code-bot:latest
container_name: qr_bot
restart: unless-stopped
env_file:
- .env
environment:
# Docker-specific overrides (container names in Docker network)
- DB_HOST=postgres
- REDIS_HOST=redis
ports:
- "${REDIRECT_PORT:-8080}:${REDIRECT_PORT:-8080}"
volumes:
- ./data:/app/data
- ./logs:/app/logs
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:${REDIRECT_PORT:-8080}/health')"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
networks:
- qr_bot_network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
postgres:
image: postgres:17-alpine
container_name: qr_bot_db
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-qr_bot}
POSTGRES_USER: ${DB_USER:-qr_bot_user}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=en_US.UTF-8"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-qr_bot_user} -d ${DB_NAME:-qr_bot}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- qr_bot_network
redis:
image: redis:8-alpine
container_name: qr_bot_redis
restart: unless-stopped
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-changeme}
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-changeme}", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- qr_bot_network
networks:
qr_bot_network:
driver: bridge
volumes:
postgres_data:
driver: local
redis_data:
driver: local