mirror of
https://github.com/ZTatman/myst.git
synced 2026-11-20 20:07:59 +00:00
- 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
29 lines
No EOL
605 B
YAML
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: |