# 算力调度服务（compute-engine / new-api）编排
# 仅服务：OpenAI 兼容 /v1 中继 + 额度/令牌/流水；仅 loopback :3000，不对外暴露。
# 镜像：本地构建（build.sh）或 calciumion/new-api:latest。

services:
  compute-engine:
    image: ${COMPUTE_ENGINE_IMAGE:-opc-compute-engine:latest}
    container_name: opc-compute-engine
    restart: always
    command: --log-dir /app/logs
    ports:
      - "127.0.0.1:3000:3000"          # 仅 loopback，算力服务经内部 IP 调用
    environment:
      - SQLITE_PATH=/data/new-api.db   # 或 MySQL: SQL_DSN=mysql+asyncmy://...
      - REDIS_CONN_STRING=redis://:redis_pass@redis:6379/0
      - SESSION_SECRET=${SESSION_SECRET:?请设置 SESSION_SECRET}
      - TZ=Asia/Shanghai
    volumes:
      - ../../serverdata/compute-data:/data
      - ../../serverdata/compute-logs:/app/logs
    networks:
      - opc-network

networks:
  opc-network:
    name: opc-network
    external: true
