services: # --------------------------------------------------------------------------- # INFRASTRUCTURE # --------------------------------------------------------------------------- postgres: image: postgres:16-alpine container_name: caliper_postgres environment: POSTGRES_USER: ${POSTGRES_USER:-caliper_user} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-caliper_password} POSTGRES_DB: ${POSTGRES_DB:-caliper_db} ports: - "${POSTGRES_PORT:-5432}:5432" volumes: - postgres_data:/var/lib/postgresql/data networks: - caliper_net healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-caliper_user} -d ${POSTGRES_DB:-caliper_db}"] interval: 5s timeout: 5s retries: 5 redis: image: redis:7-alpine container_name: caliper_redis ports: - "${REDIS_PORT:-6379}:6379" networks: - caliper_net healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 5 minio: image: minio/minio:latest container_name: caliper_minio command: server /data --console-address ":9001" environment: MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minio_admin} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minio_password} MINIO_API_CORS_ALLOW_ORIGIN: "*" ports: - "${MINIO_PORT:-9000}:9000" # API - "${MINIO_CONSOLE_PORT:-9001}:9001" # Console volumes: - minio_data:/data networks: - caliper_net healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 orthanc: image: jodogne/orthanc-plugins container_name: caliper_orthanc environment: ORTHANC_NAME: "CaliperOrthanc" # Basic configuration via env vars where supported, or mount config ports: - "${ORTHANC_DICOM_PORT:-4242}:4242" # DICOM - "${ORTHANC_HTTP_PORT:-8042}:8042" # HTTP volumes: - orthanc_data:/var/lib/orthanc/db networks: - caliper_net # --------------------------------------------------------------------------- # BACKEND SERVICES # --------------------------------------------------------------------------- backend: build: context: ./backend dockerfile: Dockerfile container_name: caliper_backend command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload volumes: - ./backend:/app - shared_data:/shared_data ports: - "${BACKEND_PORT:-8000}:8000" environment: DATABASE_URL: ${DATABASE_URL:-postgresql+asyncpg://caliper_user:caliper_password@postgres:5432/caliper_db} REDIS_URL: ${REDIS_URL:-redis://redis:6379/0} MINIO_ENDPOINT: ${MINIO_ENDPOINT:-minio:9000} MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minio_admin} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minio_password} MINIO_BUCKET: ${MINIO_BUCKET:-caliper-data} MINIO_SECURE: ${MINIO_SECURE:-false} # Same-origin by default: the viewer needs SharedArrayBuffer, which needs # COEP require-corp, which blocks direct cross-origin fetches to MinIO. # Served via the /s3 proxy in vite.config.ts and deploy/nginx.conf. MINIO_PUBLIC_URL: ${MINIO_PUBLIC_URL:-/s3} SECRET_KEY: ${SECRET_KEY:-} CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:5173,http://localhost:5174} FIRST_ADMIN_EMAIL: ${FIRST_ADMIN_EMAIL:-admin@example.com} FIRST_ADMIN_USERNAME: ${FIRST_ADMIN_USERNAME:-admin} FIRST_ADMIN_PASSWORD: ${FIRST_ADMIN_PASSWORD:-changeme123} # RAFT optical flow settings - disabled by default (Farneback works better for ultrasound) RAFT_ALLOW_CPU: ${RAFT_ALLOW_CPU:-false} depends_on: postgres: condition: service_healthy redis: condition: service_healthy minio: condition: service_healthy networks: - caliper_net worker: build: context: ./backend dockerfile: Dockerfile container_name: caliper_worker # Assuming Celery for this example, could be Arq command: celery -A app.worker.celery_app worker --loglevel=info volumes: - ./backend:/app - shared_data:/shared_data environment: DATABASE_URL: ${DATABASE_URL:-postgresql+asyncpg://caliper_user:caliper_password@postgres:5432/caliper_db} REDIS_URL: ${REDIS_URL:-redis://redis:6379/0} MINIO_ENDPOINT: ${MINIO_ENDPOINT:-minio:9000} MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minio_admin} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minio_password} MINIO_BUCKET: ${MINIO_BUCKET:-caliper-data} MINIO_SECURE: ${MINIO_SECURE:-false} # RAFT optical flow settings - disabled by default RAFT_ALLOW_CPU: ${RAFT_ALLOW_CPU:-false} depends_on: backend: condition: service_started networks: - caliper_net # Override the image's HTTP healthcheck: the worker runs Celery, not the # web server, so it has no port 8000 to probe. healthcheck: test: ["CMD-SHELL", "celery -A app.worker.celery_app inspect ping -d celery@$$HOSTNAME || exit 1"] interval: 30s timeout: 10s start_period: 30s retries: 3 # --------------------------------------------------------------------------- # FRONTEND # --------------------------------------------------------------------------- # Runs the Vite dev server inside the container. This is the configuration # this project has always shipped and run. Note it is a DEVELOPMENT server: # see the "Known limitations" section in the README. frontend: build: context: ./frontend dockerfile: Dockerfile container_name: caliper_frontend volumes: - ./frontend:/app - /app/node_modules ports: - "${FRONTEND_PORT:-5173}:5173" environment: VITE_API_URL: ${VITE_API_URL:-} VITE_ALLOWED_HOSTS: ${VITE_ALLOWED_HOSTS:-} depends_on: backend: condition: service_started networks: - caliper_net volumes: postgres_data: minio_data: orthanc_data: shared_data: networks: caliper_net: driver: bridge