firebreak/docker-compose.yml
ZTatman dcf60f4082 Add FastAPI lifespan pattern with async SQLAlchemy and Docker setup
- Move get_db to main.py for cleaner separation of concerns
- Remove engine/sessionmaker from database.py (keep only Base class)
- Fix config.py: add +asyncpg to database_url, remove @dataclass
- Add lifespan context manager for engine lifecycle
- Add docker-compose.yml for web + postgres services
- Add web/Dockerfile for containerized FastAPI app
- Add web/.env.example as environment template
2026-04-24 13:27:58 -04:00

29 lines
No EOL
605 B
YAML

services:
web:
build:
context: ./web
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql+asyncpg://myst:myst@db:5432/myst_db
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: myst
POSTGRES_PASSWORD: myst
POSTGRES_DB: myst_db
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U myst -d myst"]
interval: 5s
timeout: 5s
retries: 5
volumes:
postgres_data: