docker-compose.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # 编排配置
  2. # DeepSeek Harness Web Docker
  3. # 用法:cp .env.example .env(编辑 DSH_AUTH_USER/PASSWORD、DEEPSEEK_API_KEY)→ docker compose up -d --build
  4. # 配置、项目/会话数据与 agent 自装工具(x-cmd)持久化于 ./data(bind mount → /home/node 整个 HOME)
  5. #
  6. # Orchestration configuration
  7. # DeepSeek Harness Web Docker
  8. # Usage: cp .env.example .env (edit DSH_AUTH_USER/PASSWORD, DEEPSEEK_API_KEY) → docker compose up -d --build
  9. # Config, project/session data and agent-installed tools (x-cmd) persist in ./data (bind mount → the entire /home/node HOME)
  10. services:
  11. dsh-web:
  12. image: ghcr.io/xidong-ai/deepseek-harness-web-docker:latest
  13. build:
  14. context: .
  15. args:
  16. DSH_VERSION: ${DSH_VERSION:-0.2.2-rc.5}
  17. container_name: dsh-web
  18. restart: unless-stopped
  19. ports:
  20. - "${DSH_WEB_PORT:-3080}:3081"
  21. volumes:
  22. - ./data:/home/node
  23. env_file: .env
  24. environment:
  25. - HOME=/home/node
  26. # 健康检查:跟冒烟脚本同一条路径——抓 dsh 启动的一次性 token URL,用 token 换 cookie,
  27. # 再带 cookie 测根路径 200 算健康。
  28. # 自 0.1.2 系列起 caddy 不再 basic auth(鉴权迁回 dsh 自身),DSH_AUTH_USER/PASSWORD 不再使用。
  29. # 早于 0.1.2 的版本没有 token 机制,healthcheck 走 token 流程会失败(容器不健康)——
  30. # 所以这个 healthcheck 默认是为 0.1.2+ 设计的;回退到更早版本时需要改 healthcheck
  31. # start_period 覆盖 dsh 首启初始化(bundles 安装可能 1-2 分钟)
  32. #
  33. # Health check follows the smoke-test path: read dsh's one-time token URL, exchange it
  34. # for a cookie via 303, then GET / with the cookie and expect 200.
  35. # 0.1.2 series removed caddy basic_auth (auth moved into dsh itself), so DSH_AUTH_USER/PASSWORD
  36. # are unused. Earlier versions have no token mechanism — the healthcheck would fail, so
  37. # rollbacks must update it too.
  38. # start_period covers dsh's first-run init (bundle installation may take 1-2 minutes).
  39. healthcheck:
  40. test:
  41. - "CMD-SHELL"
  42. - "set -e; url=$$(cat /home/node/.dsh/web-launch-url.txt 2>/dev/null || true); [ -n \"$$url\" ] || exit 1; cookie=$$(mktemp); code=$$(curl -sS -c \"$$cookie\" -o /dev/null -w '%{http_code}' \"$$url\"); [ \"$$code\" = \"303\" ] || { rm -f \"$$cookie\"; exit 1; }; code=$$(curl -sS -b \"$$cookie\" -o /dev/null -w '%{http_code}' http://127.0.0.1:3081/); rm -f \"$$cookie\"; [ \"$$code\" = \"200\" ]"
  43. interval: 30s
  44. timeout: 10s
  45. retries: 3
  46. start_period: 120s