Files
mtusi2026lab2/compose.yaml
T
2026-10-23 00:20:58 +03:00

43 lines
947 B
YAML

services:
postgres:
image: postgres:16.10-bookworm
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_DB: ${DB_NAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 3s
retries: 10
migrate:
build: .
image: mtusi-messenger:lab2
command: ["alembic", "upgrade", "head"]
env_file: .env
depends_on:
postgres:
condition: service_healthy
restart: "no"
api:
build: .
image: mtusi-messenger:lab2
restart: unless-stopped
env_file: .env
ports:
- "127.0.0.1:8080:8080"
depends_on:
postgres:
condition: service_healthy
migrate:
condition: service_completed_successfully
volumes:
pgdata: