olivas/docker-compose.yml
Vadym Samoilenko 2c5e17c7c4 Add Google Cloud Run offloading for ML inference and image processing
- Create cloud_run/saliency: FastAPI service running DeepGaze I/IIE/III
  on Cloud Run (4 vCPU, 16GB RAM); pre-downloads model weights in Docker
  build to eliminate cold-start delays; returns saliency map + gaze
  sequence + hotspots + design scores
- Create cloud_run/processing: lightweight FastAPI service for heatmap
  generation and gaze sequence visualization (2 vCPU, 4GB RAM)
- Add cloud_run/deploy.sh for gcloud deployment to project optical-414516
  in region europe-west2
- Refactor analysis pipeline to route via Cloud Run when
  CLOUD_RUN_SALIENCY_URL is set, with local fallback for dev mode
- Add cloud_run_client.py with sync httpx wrappers for background tasks
- Split pyproject.toml: base = API-only deps, [ml] = torch/deepgaze for
  local dev; production Dockerfile is now lightweight (~no PyTorch)
- Preserve Dockerfile.full + docker-compose.dev.yml for local ML dev
- Auth via X-Internal-Secret header (CLOUD_RUN_SECRET env var)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 19:39:52 +00:00

48 lines
1.2 KiB
YAML

services:
postgres:
image: postgres:16-alpine
ports:
- "5453:5432"
environment:
POSTGRES_USER: olivas
POSTGRES_PASSWORD: olivas
POSTGRES_DB: olivas
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U olivas"]
interval: 5s
timeout: 5s
retries: 5
backend:
build: ./backend
ports:
- "8000:8000"
environment:
DATABASE_URL: postgresql+asyncpg://olivas:olivas@postgres:5432/olivas
UPLOAD_DIR: /app/data/uploads
DEVICE: auto
CORS_ORIGINS: http://localhost:1577
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
# Google Cloud Run — set these to enable Cloud Run offloading
CLOUD_RUN_SALIENCY_URL: ${CLOUD_RUN_SALIENCY_URL:-}
CLOUD_RUN_PROCESSING_URL: ${CLOUD_RUN_PROCESSING_URL:-}
CLOUD_RUN_SECRET: ${CLOUD_RUN_SECRET:-}
GOOGLE_CLOUD_PROJECT: ${GOOGLE_CLOUD_PROJECT:-optical-414516}
volumes:
- uploads:/app/data/uploads
depends_on:
postgres:
condition: service_healthy
frontend:
build: ./frontend
ports:
- "1577:1577"
depends_on:
- backend
volumes:
pgdata:
uploads: