-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
71 lines (67 loc) · 2.18 KB
/
Copy pathdocker-compose.yml
File metadata and controls
71 lines (67 loc) · 2.18 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
services:
postgres:
image: postgres:16-alpine@sha256:e013e867e712fec275706a6c51c966f0bb0c93cfa8f51000f85a15f9865a28cb
container_name: dotmath-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-dotmath}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}
POSTGRES_DB: ${POSTGRES_DB:-dotmath}
# Postgres доступен только внутри docker-сети.
# Для ручного доступа с сервера раскомментируйте:
# ports:
# - "127.0.0.1:5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-dotmath} -d ${POSTGRES_DB:-dotmath}"]
interval: 5s
timeout: 5s
retries: 10
networks:
- dotmath
redis:
image: redis:7-alpine@sha256:6ab0b6e7381779332f97b8ca76193e45b0756f38d4c0dcda72dbb3c32061ab99
container_name: dotmath-redis
restart: unless-stopped
# appendonly yes makes FSM state survive container restarts.
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
networks:
- dotmath
bot:
build:
context: .
dockerfile: Dockerfile
image: dotmathbot-bot
container_name: dotmath-bot
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
env_file: .env
environment:
# Inside the compose network, the bot reaches Postgres/Redis by service
# name. ``.env`` defaults to localhost for host runs; these override.
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-dotmath}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set}@postgres:5432/${POSTGRES_DB:-dotmath}
REDIS_URL: redis://redis:6379/0
volumes:
# Backups + logs live on the host so they survive container rebuilds.
- ./app/data:/app/app/data
- ./logs:/app/logs
networks:
- dotmath
volumes:
pgdata:
redisdata:
networks:
dotmath:
driver: bridge