-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
51 lines (47 loc) · 1.39 KB
/
docker-compose.yml
File metadata and controls
51 lines (47 loc) · 1.39 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
version: '3.8'
services:
bot:
build:
context: .
dockerfile: docker/bot.Dockerfile
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
env_file:
- .env
environment:
# Формируем URL внутри контейнера на лету из переменных
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-user}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-bot_db}
- REDIS_URL=redis://redis:6379/0
restart: always
db:
image: postgres:15-alpine
environment:
- POSTGRES_USER=${POSTGRES_USER:-user}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
- POSTGRES_DB=${POSTGRES_DB:-bot_db}
ports:
- "5432:5432" # Открываем порт для DataGrip / DBeaver
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres_init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-user} -d ${POSTGRES_DB:-bot_db}"]
interval: 5s
timeout: 5s
retries: 5
restart: always
redis:
image: redis:7-alpine
ports:
- "6379:6379" # Открываем порт для RedisInsight
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
restart: always
volumes:
postgres_data: