chore: strip monorepo; keep Docker runtime deploy for official dsh@latest

Image installs @deepseek-ai/dsh from npm on start. Fork 0.1.2-alpha.2 source
is obsolete for this deployment path.
This commit is contained in:
SKYMirror committed 2026-09-16 00:18:32 +08:00
commit 0bfe0b4a65
11 files changed
+638

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#!/bin/sh
# Rust 按需安装包装器:镜像里 /usr/local/bin/{cargo,rustc,rustup} 都是指向本脚本的软链接。
# 首次调用任一命令时,用 rustup-init 把最小 stable toolchain 装进 dsh-data 持久卷
# (RUSTUP_HOME/CARGO_HOME 已在镜像 ENV 中指向 /home/dsh/.dsh/...),之后直接转发到真实二进制。
# toolchain 通过 RUSTUP_DIST_SERVER(USTC 镜像)下载,重启容器后已装的 toolchain 仍保留。
set -eu
: "${RUSTUP_HOME:=/home/dsh/.dsh/rustup}"
: "${CARGO_HOME:=/home/dsh/.dsh/cargo}"
export RUSTUP_HOME CARGO_HOME
cmd="$(basename "$0")"
target="${CARGO_HOME}/bin/${cmd}"
if [ ! -x "$target" ]; then
lockdir="${RUSTUP_HOME}/.installing"
mine=0
# 并发首次调用只允许一个进程执行 rustup-init,其余进程等待它完成。
while [ "$mine" -eq 0 ]; do
if mkdir "$lockdir" 2>/dev/null; then
mine=1
elif [ -x "$target" ]; then
break
else
sleep 2
fi
done
if [ ! -x "$target" ]; then
rustup-init -y --profile minimal --default-toolchain stable --no-modify-path >&2
fi
if [ "$mine" -eq 1 ]; then
rmdir "$lockdir" 2>/dev/null || true
fi
if [ ! -x "$target" ]; then
echo "ensure-rust: rustup-init failed to install ${cmd}; check network and retry." >&2
exit 1
fi
fi
exec "$target" "$@"