services: # ── PostgreSQL with pgvector ────────────────────────────────────── db: image: pgvector/pgvector:pg17 container_name: rednote-db restart: unless-stopped ports: - "${POSTGRES_PORT:-5432}:5432" environment: POSTGRES_USER: ${POSTGRES_USER:-rednote} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-rednote} POSTGRES_DB: ${POSTGRES_DB:-rednote} volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-rednote} -d ${POSTGRES_DB:-rednote}"] interval: 5s timeout: 5s retries: 10 start_period: 30s # ── FastAPI Backend ────────────────────────────────────────────── backend: build: context: . dockerfile: backend/Dockerfile.backend container_name: rednote-backend restart: unless-stopped ports: - "${BACKEND_PORT:-8000}:8000" env_file: - backend/.env environment: DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-rednote}:${POSTGRES_PASSWORD:-rednote}@db:5432/${POSTGRES_DB:-rednote} UPLOAD_DIR: /app/uploads FASTEMBED_CACHE_PATH: /app/fastembed_cache UVICORN_WORKERS: ${UVICORN_WORKERS:-4} ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-http://localhost:80} volumes: - uploads:/app/uploads - fastembed_cache:/app/fastembed_cache depends_on: db: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/"] interval: 10s timeout: 5s retries: 5 start_period: 15s # ── React Frontend (Nginx) ────────────────────────────────────── frontend: build: context: . dockerfile: frontend/Dockerfile.frontend args: VITE_API_URL: /api container_name: rednote-frontend restart: unless-stopped ports: - "80:80" depends_on: - backend volumes: pgdata: uploads: fastembed_cache: