# QModel Docker Compose Configuration — production-safe base # ============================================================ # This base file is safe to deploy as-is: it does NOT bind-mount the repo, # so the image's own code is what runs. It ships with just the two data # files mounted read-only (they're excluded from the built image via # .dockerignore since they're large binaries that shouldn't bloat it or # require a rebuild every time the dataset changes). # # For local development with live code reload, `docker-compose.override.yml` # is picked up automatically and adds a full bind-mount on top of this. # # Configure via .env file: # LLM_BACKEND=ollama (default: local Ollama on host machine) # LLM_BACKEND=hf (HuggingFace backend) # # Usage: # docker-compose up # Dev (uses override.yml automatically) # docker-compose -f docker-compose.yml up -d # Prod (base file only, no bind-mount) # docker-compose logs -f # View logs # docker-compose down # Stop services services: qmodel: build: . container_name: qmodel-api ports: - "8000:8000" env_file: - .env environment: # Pass through HF token if using HuggingFace backend - HF_TOKEN=${HF_TOKEN:-} # Ollama host: override .env to use Docker host IP for container-to-host access - OLLAMA_HOST=http://host.docker.internal:11434 volumes: # Data files: read-only, so a data update doesn't require an image rebuild - ./QModel.index:/app/QModel.index:ro - ./metadata.json:/app/metadata.json:ro # Cache HuggingFace models to avoid re-downloading - huggingface_cache:/root/.cache/huggingface # Restart automatically if container exits restart: on-failure:5 extra_hosts: # Allow container to reach host.docker.internal on Mac/Windows - "host.docker.internal:host-gateway" networks: - qmodel-network # Health check for orchestration — /health returns 503 until ready healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 60s networks: qmodel-network: driver: bridge volumes: # Persistent cache for HuggingFace models huggingface_cache: