34 lines
950 B
YAML
34 lines
950 B
YAML
|
|
# Production: PostgreSQL + API. Set strong secrets via environment or `.env` (not committed).
|
||
|
|
services:
|
||
|
|
db:
|
||
|
|
image: postgres:16-alpine
|
||
|
|
environment:
|
||
|
|
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}
|
||
|
|
POSTGRES_DB: ${POSTGRES_DB:-operation_room}
|
||
|
|
volumes:
|
||
|
|
- pgdata_prod:/var/lib/postgresql/data
|
||
|
|
restart: unless-stopped
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||
|
|
interval: 5s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 10
|
||
|
|
start_period: 10s
|
||
|
|
|
||
|
|
api:
|
||
|
|
build:
|
||
|
|
context: .
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
environment:
|
||
|
|
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-operation_room}
|
||
|
|
ports:
|
||
|
|
- "${API_PORT:-8000}:8000"
|
||
|
|
depends_on:
|
||
|
|
db:
|
||
|
|
condition: service_healthy
|
||
|
|
restart: unless-stopped
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
pgdata_prod:
|