| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- version: "3.8"
- # ============================================================
- # LambdAgent PaaS — Docker Compose 一键启动
- # 用法:
- # docker compose up # 开发模式(默认)
- # docker compose --profile prod up # 生产模式(含 PostgreSQL + Redis)
- # ============================================================
- services:
- # ── AgentPaaS API 服务 ──────────────────────────────────
- api:
- build:
- context: .
- dockerfile: Dockerfile
- ports:
- - "${AGENTPAAS_PORT:-8000}:8000"
- env_file:
- - .env
- environment:
- AGENTPAAS_DEBUG: "true"
- AGENTPAAS_HOST: "0.0.0.0"
- AGENTPAAS_PORT: "8000"
- volumes:
- - .:/app
- - pip-cache:/root/.cache/pip
- restart: unless-stopped
- healthcheck:
- test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
- interval: 30s
- timeout: 10s
- retries: 3
- start_period: 15s
- # ── PostgreSQL(生产模式)────────────────────────────────
- db:
- image: postgres:16-alpine
- profiles: ["prod"]
- environment:
- POSTGRES_DB: agentpaas
- POSTGRES_USER: agentpaas
- POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-agentpaas_dev_password}"
- ports:
- - "5432:5432"
- volumes:
- - pgdata:/var/lib/postgresql/data
- restart: unless-stopped
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U agentpaas"]
- interval: 10s
- timeout: 5s
- retries: 5
- # ── Redis(生产模式)────────────────────────────────────
- redis:
- image: redis:7-alpine
- profiles: ["prod"]
- ports:
- - "6379:6379"
- volumes:
- - redisdata:/data
- restart: unless-stopped
- healthcheck:
- test: ["CMD", "redis-cli", "ping"]
- interval: 10s
- timeout: 5s
- retries: 5
- volumes:
- pip-cache:
- pgdata:
- redisdata:
|