Files
fastapi-todo-api/docker-compose.yml
2026-05-19 10:00:21 +02:00

37 lines
790 B
YAML

services:
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: fastapiuser
POSTGRES_PASSWORD: student123
POSTGRES_DB: fastapidb
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "fastapiuser", "-d", "fastapidb"]
interval: 5s
timeout: 5s
retries: 10
api:
build: .
restart: unless-stopped
ports:
- "8000:8000"
environment:
DATABASE_HOST: db
DATABASE_PORT: "5432"
POSTGRES_USER: fastapiuser
POSTGRES_PASSWORD: student123
POSTGRES_DB: fastapidb
depends_on:
db:
condition: service_healthy
volumes:
postgres_data: