Files
mtusi2026lab2/docker-compose.yaml
T
2026-11-03 13:26:49 +03:00

38 lines
1.1 KiB
YAML

services:
db:
image: postgres:16-alpine
container_name: lab2_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: messenger_db
ports:
- "5433:5432" # Пробрасываем на 5433, чтобы не конфликтовать с локальным Mac PG
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d messenger_db"]
interval: 5s
timeout: 3s
retries: 5
app:
build: .
container_name: lab2_app
environment:
# Внутри Docker сеть имя сервиса 'db' резолвится в IP контейнера базы, порт 5432
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/messenger_db
ports:
- "8080:8080"
depends_on:
db:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_data: