# OpenBiliClaw backend via the prebuilt multi-arch image on GHCR. # # This file is self-contained — no git clone or local build needed: # # curl -fsSLO https://raw.githubusercontent.com/whiteguo233/OpenBiliClaw/main/docker-compose.prebuilt.yml # docker compose -f docker-compose.prebuilt.yml up -d # # then open http://127.0.0.1:8420/setup/ for AI config + prereq checks, # # and run the (container-required) init step from the host: # # docker exec -it openbiliclaw-backend openbiliclaw init # # Upgrade to the newest release: # # docker compose -f docker-compose.prebuilt.yml pull # docker compose -f docker-compose.prebuilt.yml up -d # # To build from source instead (customization / development), use the # docker-compose.yml at the repository root — see docs/docker-deployment.md. services: # Ollama sidecar — bundled embedding service so users don't need to # install Ollama on their host. Pulls bge-m3 on first start (~568MB, # CPU-only) and keeps the daemon running on the internal Docker # network at http://ollama:11434. The backend's [llm.embedding] gets # seeded to point here automatically on first config bootstrap. # # Prefer a cloud embedding provider instead? Remove this block plus # the backend's depends_on and OPENBILICLAW_SEED_OLLAMA_DEFAULTS. ollama: image: ollama/ollama:latest container_name: openbiliclaw-ollama volumes: - openbiliclaw_ollama:/root/.ollama entrypoint: - /bin/sh - -c - | ollama serve & SERVE_PID=$$! echo "[ollama-init] waiting for daemon..." i=0 while [ $$i -lt 90 ]; do ollama list >/dev/null 2>&1 && break sleep 1 i=$$((i+1)) done echo "[ollama-init] daemon ready" if ! ollama list 2>/dev/null | grep -q '^bge-m3'; then echo "[ollama-init] pulling bge-m3 (~568MB, may take a few minutes on first start)..." ollama pull bge-m3 || echo "[ollama-init] pull failed; daemon stays up so you can retry" fi echo "[ollama-init] bge-m3 ready, daemon staying up" wait $$SERVE_PID healthcheck: # Healthy = daemon up AND bge-m3 is locally available. start_period # covers the first-time pull on slow networks. test: ["CMD-SHELL", "ollama list 2>/dev/null | grep -q '^bge-m3'"] interval: 30s timeout: 10s retries: 6 start_period: 300s restart: unless-stopped openbiliclaw-backend: # Multi-arch image (linux/amd64 + linux/arm64) published by # .github/workflows/release-docker.yml on every backend release. # Pin a specific version by replacing `latest` with e.g. `0.3.152`. image: ghcr.io/whiteguo233/openbiliclaw-backend:latest container_name: openbiliclaw-backend depends_on: # service_started (not service_healthy) on purpose: the sidecar is # only "healthy" once bge-m3 finished downloading. A health gate # here would keep the backend from ever starting when the first # pull fails — instead the backend boots immediately and /setup/ # surfaces "embedding not ready yet" until the pull completes. ollama: condition: service_started environment: OPENBILICLAW_PROJECT_ROOT: /app/runtime OPENBILICLAW_CONFIG_TEMPLATE: /app/config.example.toml OPENBILICLAW_PROXY_HOST: ${OPENBILICLAW_PROXY_HOST:-host.docker.internal} OPENBILICLAW_PROXY_PORT: ${OPENBILICLAW_PROXY_PORT:-7897} OPENBILICLAW_PROXY_TIMEOUT: ${OPENBILICLAW_PROXY_TIMEOUT:-1.0} # On first config bootstrap, seed [llm.ollama] base_url and # [llm.embedding] to point at the bundled sidecar above. Existing # config.toml is never overwritten. OPENBILICLAW_SEED_OLLAMA_DEFAULTS: "1" OPENBILICLAW_OLLAMA_BASE_URL: "http://ollama:11434/v1" OPENBILICLAW_EMBEDDING_MODEL: "bge-m3" # ``host.docker.internal`` resolves the host machine from inside the # container (proxy auto-detect, host-side Ollama). Required on Linux # Docker; auto-provided by Docker Desktop on Mac / Windows. extra_hosts: - "host.docker.internal:host-gateway" ports: - "8420:8420" volumes: - openbiliclaw_config:/app/runtime - openbiliclaw_data:/app/runtime/data - openbiliclaw_logs:/app/runtime/logs healthcheck: test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8420/api/health', timeout=4).status==200 else 1)"] interval: 30s timeout: 5s start_period: 20s retries: 3 restart: unless-stopped volumes: openbiliclaw_config: openbiliclaw_data: openbiliclaw_logs: # Persists ollama models across container recreations so users don't # have to re-pull bge-m3 on every rebuild. openbiliclaw_ollama: