feat: 添加可选的代理功能支持

新增功能:
- 集成 Cloudflare WARP socks5 代理服务
- 通过环境变量 USE_PROXY 控制代理开关
- 支持自定义 HTTP/HTTPS/SOCKS5 代理服务器
- 使用 docker compose profile 管理 proxy 服务

配置方式:
- USE_PROXY=true 启用代理
- ALL_PROXY/HTTP_PROXY/HTTPS_PROXY 自定义代理
- docker compose --profile proxy up 启动 warp 服务

文件变更:
- docker-compose.yaml: 添加 warp-proxy 服务
- playwright-auth.ts: 添加代理配置逻辑
- example.env: 添加代理环境变量
- PROXY.md: 使用文档
This commit is contained in:
JamesFlare1212
2026-04-06 16:37:54 -04:00
parent 4e04063469
commit 4a97057825
4 changed files with 209 additions and 5 deletions

View File

@@ -1,4 +1,16 @@
services:
# Warp Socks Proxy Service (Optional - starts with --profile proxy)
warp-proxy:
image: ghcr.io/mon-ius/docker-warp-socks:v5
container_name: dsas-cca-warp-proxy
restart: unless-stopped
networks:
- cca_network
expose:
- "9091"
profiles:
- proxy
app:
build:
context: .
@@ -11,16 +23,24 @@ services:
environment:
- NODE_ENV=production
- PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
# Proxy configuration (only active when USE_PROXY=true)
- USE_PROXY=${USE_PROXY:-false}
- HTTP_PROXY=${HTTP_PROXY:-}
- HTTPS_PROXY=${HTTPS_PROXY:-}
- ALL_PROXY=${ALL_PROXY:-}
restart: unless-stopped
depends_on:
redis:
condition: service_healthy
warp-proxy:
condition: service_started
required: false
volumes:
- ./services/cookies.json:/usr/src/app/services/cookies.json
networks:
- cca_network
mem_limit: 1g
cpus: 1.0
extra_hosts:
- "host.docker.internal:host-gateway"
redis:
image: "redis:8.0-alpine"
@@ -36,7 +56,6 @@ services:
interval: 10s
timeout: 5s
retries: 5
mem_limit: 256m
volumes:
redis_data: