services: api: build: . environment: - DATA_ROOT=/data - DATABASE_URL=sqlite:////data/db/coupledmd.sqlite - API_PORT=8000 # Writable state DBs (API keys + optional accounts). Mounted at /state, # OUTSIDE the read-only /data bind below — a named volume can't create its # mountpoint inside a read-only bind mount (Docker fails with # "read-only file system" at container start). Verified on the deploy host. - KEYS_DB_PATH=/state/keys.db - ACCOUNTS_DB_PATH=/state/accounts.db # CORS_ORIGINS is only needed if the frontend is served from a different # origin than the API. In the default setup nginx serves both, so leave # this empty. For local development with the Vite dev server, set: # CORS_ORIGINS=http://localhost:5173 - CORS_ORIGINS=${CORS_ORIGINS:-} volumes: # Single bind-mount: move DATA_ROOT here when migrating to the university host. - ${DATA_ROOT:-.}:/data:ro # Writable per-host state for API keys + optional accounts (not the # analysis data, which stays read-only above). See note on /state above. - api-state:/state restart: unless-stopped healthcheck: test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/v1/health')"] interval: 30s timeout: 5s retries: 3 # No published port — nginx is the only public entry point. # Uncomment the lines below for direct API access during development. # ports: # - "${API_PORT:-8000}:${API_PORT:-8000}" nginx: image: nginx:1.27-alpine ports: - "${HTTP_PORT:-80}:80" - "${HTTPS_PORT:-443}:443" volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro - ./frontend/dist:/usr/share/nginx/html:ro # SSL certificates — mount your certs directory here. # For Let's Encrypt: ./certs:/etc/nginx/ssl:ro # For self-signed: generate and mount to the same path. - ${SSL_CERT_DIR:-./certs}:/etc/nginx/ssl:ro # Persist nginx logs - nginx-logs:/var/log/nginx depends_on: api: condition: service_healthy restart: unless-stopped volumes: nginx-logs: # Per-host writable state for API keys + optional accounts (mounted at /state # in the api service). Must be declared here or `docker compose up` fails. api-state: