From a73f1b326ba0df4ab2ceaea132136274512364ce Mon Sep 17 00:00:00 2001 From: chairman's chair Date: Fri, 27 Mar 2026 01:42:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=A5=E9=87=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E2=80=94=20Docker=E7=BC=BAbash/allowBots/?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Dockerfile: 添加 bash 到 apk install(Alpine 无 bash 导致容器无法启动) - Dockerfile: 移除无用的 gui node_modules COPY(被 npm ci 覆盖) - Dockerfile: --only=production → --omit=dev(旧 flag 已废弃) - configs/tang-sansheng: allowBots: false → "mentions"(false 导致 bot 间通信全断) - configs/modern-ceo: allowBots: true → "mentions"(true 可能导致消息循环) - entrypoint.sh: 修复 set -e + wait 信号处理 + $@ 为空保护 - install-mac.sh: npm install -g openclaw 加 || true(set -e 下失败会跳过 fallback) - install-lite.sh: $HOME → ${HOME:-}(set -u 下未定义会崩溃) - install.ps1: 转义 $(curl ...) 防止 PowerShell 在 here-string 中执行 Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 4 ++-- configs/modern-ceo/openclaw.json | 4 ++-- configs/tang-sansheng/openclaw.json | 4 ++-- docker/entrypoint.sh | 8 +++++--- install-lite.sh | 2 +- install-mac.sh | 2 +- install.ps1 | 4 ++-- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index bdc8b84..4fb6fc1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,7 @@ LABEL maintainer="wanikua" \ # 安装系统依赖(合并为单层减小体积) RUN apk add --no-cache \ + bash \ curl \ git \ ca-certificates \ @@ -79,12 +80,11 @@ RUN chmod +x /entrypoint.sh /init-docker.sh # 复制 GUI 构建产物 COPY --from=gui-builder /build/dist/ /opt/gui/dist/ -COPY --from=gui-builder /build/node_modules/ /opt/gui/server/node_modules/ COPY gui/server/ /opt/gui/server/ COPY gui/package.json /opt/gui/package.json # 安装 GUI 后端依赖 -RUN cd /opt/gui/server && npm ci --only=production --loglevel=error && \ +RUN cd /opt/gui/server && npm ci --omit=dev --loglevel=error && \ chown -R court:court /opt/gui # 复制 Skills(只读模板) diff --git a/configs/modern-ceo/openclaw.json b/configs/modern-ceo/openclaw.json index 152b05a..8b24dea 100644 --- a/configs/modern-ceo/openclaw.json +++ b/configs/modern-ceo/openclaw.json @@ -237,7 +237,7 @@ "enabled": true, "dmPolicy": "open", "groupPolicy": "open", - "allowBots": true, + "allowBots": "mentions", "accounts": { "board": { "name": "Board", @@ -334,7 +334,7 @@ "enabled": false, "dmPolicy": "open", "groupPolicy": "open", - "allowBots": true, + "allowBots": "mentions", "accounts": { "ceo": { "appId": "YOUR_CEO_APP_ID", diff --git a/configs/tang-sansheng/openclaw.json b/configs/tang-sansheng/openclaw.json index 72dbc55..6f8f3a6 100644 --- a/configs/tang-sansheng/openclaw.json +++ b/configs/tang-sansheng/openclaw.json @@ -291,7 +291,7 @@ "enabled": true, "dmPolicy": "open", "groupPolicy": "open", - "allowBots": false, + "allowBots": "mentions", "accounts": { "silijian": { "name": "司礼监", @@ -374,7 +374,7 @@ "enabled": false, "dmPolicy": "open", "groupPolicy": "open", - "allowBots": false, + "allowBots": "mentions", "accounts": { "silijian": { "appId": "YOUR_FEISHU_APP_ID", diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index f16a5fd..c8cce3e 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -189,6 +189,8 @@ if command -v openclaw &>/dev/null && [ -f "$CONFIG_DIR/openclaw.json" ]; then fi fi -"$@" & -GATEWAY_PID=$! -wait $GATEWAY_PID +if [ $# -gt 0 ]; then + "$@" & + GATEWAY_PID=$! + wait $GATEWAY_PID || true +fi diff --git a/install-lite.sh b/install-lite.sh index f9776fe..62fef04 100755 --- a/install-lite.sh +++ b/install-lite.sh @@ -87,7 +87,7 @@ echo "" echo -e "${YELLOW}[1/5] 初始化朝廷工作区...${NC}" # 确保 HOME 变量有效(修复 Windows Git Bash 和非交互式 shell 环境) -if [ -z "$HOME" ]; then +if [ -z "${HOME:-}" ]; then HOME=$(getent passwd "$(id -un)" | cut -d: -f6) [ -z "$HOME" ] && HOME="/root" export HOME diff --git a/install-mac.sh b/install-mac.sh index 4318ca8..aeb2bae 100755 --- a/install-mac.sh +++ b/install-mac.sh @@ -97,7 +97,7 @@ if command -v openclaw &>/dev/null; then echo -e " ${GREEN}✓ OpenClaw $(openclaw --version 2>/dev/null) 已安装${NC}" else echo -e " ${CYAN}→ 安装 OpenClaw...${NC}" - npm install -g openclaw 2>/dev/null + npm install -g openclaw 2>/dev/null || true if command -v openclaw &>/dev/null; then CLI_CMD="openclaw" CONFIG_DIR="$HOME/.openclaw" diff --git a/install.ps1 b/install.ps1 index 4688b32..f250333 100644 --- a/install.ps1 +++ b/install.ps1 @@ -278,13 +278,13 @@ Get-Content $env:APPDATA\..\Local\openclaw\logs\gateway.log -Tail 50 **方式 A:使用 WSL2(推荐)** \`\`\`powershell -wsl bash -c "$(curl -fsSL https://raw.githubusercontent.com/wanikua/danghuangshang/main/install-lite.sh)" +wsl bash -c "`$(curl -fsSL https://raw.githubusercontent.com/wanikua/danghuangshang/main/install-lite.sh)" \`\`\` **方式 B:使用 Git Bash** 安装 Git for Windows 后,在 Git Bash 中运行: \`\`\`bash -bash -c "$(curl -fsSL https://raw.githubusercontent.com/wanikua/danghuangshang/main/install-lite.sh)" +bash -c "`$(curl -fsSL https://raw.githubusercontent.com/wanikua/danghuangshang/main/install-lite.sh)" \`\`\` > 详细说明见 [docs/windows-wsl.md](https://github.com/wanikua/danghuangshang/blob/main/docs/windows-wsl.md)