services: dataclaw-api: build: context: . dockerfile: ./dataclaw-api/Dockerfile args: # 国内网络访问 deb.debian.org 失败时:APT_CN_MIRROR=true docker compose build APT_CN_MIRROR: ${APT_CN_MIRROR:-false} restart: unless-stopped ports: - "10001:8000" extra_hosts: - "host.docker.internal:host-gateway" volumes: - ./data:/app/data environment: # 应用元数据仍为 SQLite(见 DATA_ROOT);此地址供 NL2SQL 等 Postgres 连接器使用 - POSTGRES_URL=postgresql://user:pass@db:5432/dataclaw - PYTHONPATH=/app - DATA_ROOT=/app/data depends_on: db: condition: service_healthy healthcheck: test: ["CMD-SHELL", "curl -f http://127.0.0.1:8000/docs >/dev/null 2>&1 || exit 1"] interval: 15s timeout: 5s retries: 5 start_period: 120s dataclaw-ui: build: context: ./dataclaw-ui dockerfile: Dockerfile restart: unless-stopped ports: - "10002:80" depends_on: dataclaw-api: condition: service_healthy db: image: postgres:15-alpine restart: unless-stopped environment: - POSTGRES_USER=user - POSTGRES_PASSWORD=pass - POSTGRES_DB=dataclaw volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U user -d dataclaw"] interval: 5s timeout: 5s retries: 5 volumes: postgres_data: