# ============================================================ # ZCLAW SaaS Backend - Docker Compose # ============================================================ # Usage: # cp saas-env.example .env # then edit .env with real values # docker compose up -d # docker compose logs -f saas # ============================================================ services: # ---- PostgreSQL 16 ---- postgres: image: pgvector/pgvector:pg16 container_name: zclaw-postgres restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-your_secure_password} POSTGRES_DB: ${POSTGRES_DB:-zclaw} # 确保 UTF-8 编码 — 中文 Windows 默认 GBK 会导致中文数据损坏 POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C.UTF-8" ports: - "${POSTGRES_PORT:-5432}:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-zclaw}"] interval: 10s timeout: 5s retries: 5 start_period: 10s networks: - zclaw-saas # ---- SaaS Backend ---- saas: build: context: . dockerfile: Dockerfile container_name: zclaw-saas restart: unless-stopped ports: - "127.0.0.1:${SAAS_PORT:-8080}:8080" env_file: - .env environment: DATABASE_URL: postgres://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-your_secure_password}@postgres:5432/${POSTGRES_DB:-zclaw} depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 30s timeout: 5s retries: 3 start_period: 15s networks: - zclaw-saas volumes: postgres_data: driver: local networks: zclaw-saas: driver: bridge