AdvisoryBuilderWorkshop / docker-compose.yml
NeonClary's picture
Deploy tutorial feature and recent fixes
d8808e7 verified
Raw
History Blame Contribute Delete
1.82 kB
# Local dev: FastAPI (uvicorn --reload) + Vite HMR.
# Persistence is SQLite + files under ./data (matches HF Storage Bucket layout in prod).
# Usage: docker compose up --build
# UI: http://localhost:5173 | API: http://localhost:8000 | /docs on API
name: cu-student-helper
services:
api:
build:
context: .
dockerfile: Dockerfile.backend-dev
ports:
- "8000:8000"
env_file:
- ${ENV_FILE_PATH:-${USERPROFILE:-${HOME}}/.secrets/shared.env}
environment:
DATA_DIR: /app/data
SERVE_FRONTEND_STATIC: "false"
CORS_ORIGINS: http://localhost:5173,http://127.0.0.1:5173,http://localhost:8000,http://127.0.0.1:8000
# Windows bind mounts often miss inotify events; force polling so uvicorn --reload picks up edits.
WATCHFILES_FORCE_POLLING: "true"
volumes:
- ./backend:/app/backend
- ./data:/app/data
command:
[
"uvicorn",
"app.main:app",
"--host",
"0.0.0.0",
"--port",
"8000",
"--reload",
"--reload-dir",
"/app/backend/app",
]
frontend:
image: node:20-bookworm
working_dir: /app/frontend
ports:
- "5173:5173"
volumes:
- ./frontend:/app/frontend
- frontend_node_modules:/app/frontend/node_modules
environment:
CHOKIDAR_USEPOLLING: "true"
WATCHPACK_POLLING: "true"
API_PROXY_TARGET: http://api:8000
# Faster polling on Windows Docker bind mounts (default interval can feel "stuck").
CHOKIDAR_INTERVAL: "300"
command:
[
"sh",
"-c",
"test -d node_modules/react || npm ci; npm run dev -- --host 0.0.0.0 --port 5173",
]
depends_on:
- api
volumes:
frontend_node_modules: