Sin descripción

PJ568 f8664eeaef 【维护,构建】升级 dsh 版本至 0.2.2-rc.5 hace 1 semana
.github fbb4be5b6d 【修复,CI】门闩与清理脚本补齐 gh 凭据 hace 2 meses
defaults e900eba38a 【更改,构建】镜像内置编译工具链与 Rust hace 3 meses
docs c843943b78 【新增,文档】添加 README 双语 banner 头图 hace 3 meses
scripts a17f133ec9 【修复,CI】冒烟测试留存 patch 全文证据 hace 1 mes
tests fe73f5f09b 【修复,脚本】失败 Issue 门闩按版本边界匹配 hace 2 meses
.dockerignore 1dfb1a5e47 【初始】 hace 3 meses
.env.example 4c0ea44e8b 【修复,文档】Oracle 二次复核反馈:.env.example 顶部加同步升级警告 hace 2 meses
.gitignore 1dfb1a5e47 【初始】 hace 3 meses
Caddyfile ffd0bdb696 【更改,构建】全面适配 dsh 0.1.2-rc.1+ 鉴权(token+cookie) hace 2 meses
DESIGN.md 34bf7356b2 【新增,CI】合并请求触发构建冒烟验证 hace 2 meses
Dockerfile 0c38d2477c 【维护,构建】升级 dsh 版本至 0.2.2-rc.5 hace 1 semana
LICENSE 1dfb1a5e47 【初始】 hace 3 meses
README.md 0c38d2477c 【维护,构建】升级 dsh 版本至 0.2.2-rc.5 hace 1 semana
README.zh.md 0c38d2477c 【维护,构建】升级 dsh 版本至 0.2.2-rc.5 hace 1 semana
docker-compose.yml 0c38d2477c 【维护,构建】升级 dsh 版本至 0.2.2-rc.5 hace 1 semana
entrypoint.sh 8a4939a85a 【修复,构建】修复首启日志属主导致的 token 提取失败 hace 2 meses
supervisord.conf ffd0bdb696 【更改,构建】全面适配 dsh 0.1.2-rc.1+ 鉴权(token+cookie) hace 2 meses

README.md

DeepSeek Harness Web Docker

banner

English | 中文

Containerized deployment of the DeepSeek Harness (dsh) web client: a single container bundles dsh + Caddy (pure reverse proxy, no auth) with configuration and project/session data persisted, and CI automatically pushes GHCR images.

Features

  • Self-contained single container: dsh (loopback only, inside the container) + Caddy pure reverse proxy (Host/Origin rewritten to loopback for the dsh anti-DNS-rebinding fence)
  • Authentication since dsh 0.2.2-rc.5: moved into dsh itself. On first start, dsh prints a one-time ?token=… URL; the browser exchanges it for a persistent cookie (survives restarts). Caddy basic auth was removed in 0.2.2-rc.5+ (would have intercepted the browser's first redirect and hidden the token URL)
  • Configuration and project/session data persisted: bind mount ./data → /home/node (the whole HOME: settings.yaml, API Key, profiles, sessions, storages, plus agent-installed tools under ~/.x-cmd.root)
  • Runs as non-root (uid 1000); dsh is not exposed directly
  • Built-in health check: docker compose ps shows the real service health (starting/healthy/unhealthy), exchanging the one-time token for a cookie and probing dsh
  • Pinnable image version: build argument DSH_VERSION
  • CI automatically builds and pushes ghcr.io/xidong-ai/deepseek-harness-web-docker (latest + date-time-hash tags)
  • Every pull request runs the same build + smoke test as a merge gate (PRs never push images); publishing happens only on push to master or manual dispatch
  • A scheduled CI job checks the dsh upstream daily: on a new version it bumps DSH_VERSION, builds and smoke-tests the image, pushes to master on success, or opens an Issue on failure (a failed version is not retried automatically while its Issue is open; manual dispatch bypasses the gate)
  • The GHCR release can be triggered manually (Actions tab → "Run workflow") or is hooked automatically after an upstream auto-upgrade (workflow_dispatch)

Quick Start

Option 1: Use the GHCR image

git clone https://github.com/Xidong-AI/deepseek-harness-web-docker
cd deepseek-harness-web-docker
cp .env.example .env    # edit DEEPSEEK_API_KEY (DSH_AUTH_USER/PASSWORD are now optional, only used on rollback to ≤0.1.1 series)
docker compose up -d    # pull the latest image and start

⚠️ 升级警告 — 升级到含 dsh 0.2.2-rc.5+ 鉴权迁移的版本时,必须先 git pull 同步 docker-compose.yml / Caddyfile / entrypoint.sh / entrypoint.sh 内的 token 抓取后台任务,仅 docker compose pull 拉新 image 配旧 compose 文件会导致 healthcheck 永远 unhealthy 且 web 服务裸奔 (无鉴权)。 具体见 PR #7 的 commit message 与 DESIGN.md §10 的版本演进记录。

Option 2: Build locally

docker compose up -d --build
# or pin a dsh version:
docker build --build-arg DSH_VERSION=0.2.2-rc.5 -t dsh-web:latest .

After startup, read the one-time launch URL with one of:

docker compose logs dsh-web | grep 'dsh web:'         # dsh prints it on startup
# or
docker exec dsh-web cat /home/node/.dsh/web-launch-url.txt

Then open the printed URL (e.g. http://<host>:3080/?token=…) in a browser. The browser is redirected (HTTP 303) to / with a persistent cookie set; subsequent visits work without the token. The cookie lives in ./data/.dsh/.credentials.yaml and survives container restarts (re-roll the token URL each time you recreate the data volume from scratch). The port is DSH_WEB_PORT (default 3080).

Up to dsh 0.1.1 series (rollback): open http://<host>:3080 and use Caddy basic auth (the DSH_AUTH_USER / DSH_AUTH_PASSWORD in .env).

Environment Variables (.env)

Variable Required Default Description
DSH_AUTH_USER No (since 0.2.2-rc.5) admin Was: Basic Auth username. Now kept only for rollback to ≤0.1.1 series; ignored on 0.2.2-rc.5+
DSH_AUTH_PASSWORD No (since 0.2.2-rc.5) None Was: Basic Auth plaintext password (bcrypt hash auto-generated). Now kept only for rollback to ≤0.1.1 series
DEEPSEEK_API_KEY Yes None DeepSeek API Key (referenced by the provider via apiKeyEnv)
DSH_WEB_PORT No 3080 Host port exposed to the outside (change it when it conflicts with an existing service)
DSH_TRUSTED_HOSTS No Empty Comma-separated extra trusted hosts, injected into the profile's cordis.patch.yml (only when the file is absent or still the empty template; user-maintained files are skipped — edit the file directly); by default Caddy rewrites Host/Origin to loopback, which covers normal access
DSH_VERSION No (build-time) Upstream latest dsh version; rebuild with --build after changing it

.env contains passwords and the API Key — never commit it to the repository.

Data Persistence

All configuration and data is stored in ./data/ under the project directory (git-ignored):

  • settings.yaml: dsh configuration (auto-generated from the default template on first startup)
  • .credentials.yaml: credentials (e.g. API Keys configured via the web UI)
  • profiles/web/: web profile (auto-initialized by dsh on first startup)
  • sessions/, storages/: session and project data

Deleting the container does not affect the data; configuration is preserved after upgrades.

Upgrading

docker compose pull && docker compose up -d   # when using the GHCR image
# or rebuild locally:
docker compose build && docker compose up -d

In-Container Tools & Environment

dsh agents run commands inside the container through the bash tool; the available toolset = what's preinstalled in the image + tools the agent installs itself (x-cmd).

Preinstalled in the image

  • Runtime: node 22, npm, pnpm (corepack, required by dsh plugin), python3, Caddy, dsh
  • Build toolchain: make/gcc/g++/pkg-config (node-gyp fallback for native modules, e.g. a dsh plugin's node-pty), Rust (rustup stable minimal + rustfmt + clippy)
  • Agent tools: git, openssh-client, curl/wget (network), jq/yq (JSON/YAML), ripgrep (search), rsync (sync), procps (processes), zip/unzip/tar, file, dig, sqlite3, python3-pip, vim-tiny, ca-certificates

Agent self-installation (x-cmd, no root required)

The image ships x-cmd (auto-installed to the data volume on first startup; idempotent; Alibaba Cloud OSS source). Inside a dsh session you can run:

x env use git python jq       # install/enable tools (no root)
x env ls                      # list enabled tools
x env which jq                # show tool path
x jq . data.json              # call with x prefix (always available)
jq . data.json                # bare command: enabled packages are symlinked to /usr/local/bin, directly usable
  • Install location: ~/.x-cmd.root (inside the data volume ./data), preserved across container restart/rebuild
  • The x command and enabled tools are automatically symlinked to /usr/local/bin (the agent's bash PATH is fixed; the symlink is the only entry point)
  • Newly installed tools are invoked with the x <pkg> prefix in the current session; bare commands become available after the container restarts
  • Tools come from the x-cmd package source (Alibaba Cloud OSS, reachable from mainland China) and support version management (x env use node=v20)

Sandbox caveat: x-cmd writes to ~/.x-cmd.root (inside the data volume) to run. The file sandbox (workspace-write) only permits writes inside the session workspace plus /tmp, so this directory is not writable: under a bwrap sandbox x refuses to start with folder defined ___X_CMD_ROOT specified is not writable; under the Landlock sandbox (this image ships no bwrap) x starts and read-only use works — built-in modules (x version, x passwd) and already-enabled or cached packages (x <pkg>, symlinked bare commands) — but installing/enabling new packages fails: x env use errors with permission denied, x env ls silently returns empty. To install new tools the agent must request full permissions (approval), or pick /home/node as the session workspace.

For the in-container agent environment guide, see AGENTS.md in the data volume (auto-loaded by dsh sessions).

The image already ships a lightweight build toolchain (make/gcc/g++) and Rust, so agents can run pnpm install/cargo build to compile native modules and projects directly. Other system packages that require root can be added by modifying the apt-get install line in the Dockerfile and rebuilding, or by adding a layer on top of this image:

FROM ghcr.io/xidong-ai/deepseek-harness-web-docker:latest
RUN apt-get update && apt-get install -y --no-install-recommends <pkg> \
 && rm -rf /var/lib/apt/lists/*

Changing the Password / Resetting Auth

dsh 0.2.2-rc.5+ (current): dsh's persistent cookie is the auth, kept in ./data/.dsh/.credentials.yaml. To reset after a suspected leak, you must rebuild the data volume — docker compose down -v && docker compose up -d. The next browser visit uses a new one-time token URL (docker exec dsh-web cat /home/node/.dsh/web-launch-url.txt).

⚠️ down -v is destructive: it also wipes ./data/.dsh/ (settings, profiles, sessions, agent-installed tools under ~/.x-cmd.root). There is no lighter reset path — the entrypoint's token-extraction background task is one-shot (grep -m1), so a single-file .credentials.yaml delete plus container restart will NOT refresh the token URL. If you need to preserve session data, take a backup of ./data/.dsh/ before down -v and restore specific subpaths afterwards (e.g. .dsh/profiles/, .dsh/AGENTS.md).

Up to dsh 0.1.1 series (rollback): edit DSH_AUTH_PASSWORD in .env, then run docker compose up -d (the entrypoint regenerates the hash automatically).

Acknowledgements

Thanks to the Linux.do community for support.