使用 Docker Compose profiles 功能,默认不启动 tunnel 服务 启用方式: docker compose --profile tunnel up -d 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
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}
|
||
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
|
||
|
||
# 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
|