Files
droid2api/docker-compose.yml
empty 0504029e47 feat: 添加共享网络配置支持独立部署
- 配置 api-network 外部网络
- 支持与 new-api 独立部署但可互通
- 添加 AUTH_ENABLED 和 API_KEYS 环境变量
2025-12-27 16:46:50 +08:00

60 lines
1.9 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
droid2api:
build: .
container_name: droid2api
ports:
- "3001:3000"
environment:
# 认证配置(按优先级选择其一):
# 最高优先级固定API密钥推荐用于生产环境
- FACTORY_API_KEY=${FACTORY_API_KEY}
# 次优先级refresh token自动刷新机制
- DROID_REFRESH_KEY=${DROID_REFRESH_KEY}
# 可选如果需要修改端口在config.json中配置
# 阿里云日志服务配置
- ALIYUN_ACCESS_KEY_ID=${ALIYUN_ACCESS_KEY_ID}
- ALIYUN_ACCESS_KEY_SECRET=${ALIYUN_ACCESS_KEY_SECRET}
- ALIYUN_SLS_ENDPOINT=${ALIYUN_SLS_ENDPOINT}
- ALIYUN_SLS_PROJECT=${ALIYUN_SLS_PROJECT}
- ALIYUN_SLS_LOGSTORE=${ALIYUN_SLS_LOGSTORE}
# API 认证中间件
- AUTH_ENABLED=${AUTH_ENABLED:-false}
- API_KEYS=${API_KEYS}
volumes:
# 可选持久化auth.json以保存刷新的tokens
- ./data:/app/data
# 多账号配置文件(由 sync-accounts.sh 同步)
- ./accounts.json:/app/accounts.json:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- api-network
# Cloudflare Tunnel (可选)
# 启用方式: docker compose --profile tunnel up -d
# 需要在 .env 中设置 TUNNEL_TOKEN
tunnel:
image: cloudflare/cloudflared:latest
container_name: droid2api_tunnel
restart: unless-stopped
command: tunnel run
environment:
- TUNNEL_TOKEN=${TUNNEL_TOKEN}
depends_on:
- droid2api
profiles:
- tunnel
networks:
- api-network
# 共享网络配置 - 支持与 new-api 等其他服务独立部署但可互通
# 首次使用需先创建网络: docker network create api-network
networks:
api-network:
external: true