huanbao commited on
Commit
969696d
·
verified ·
1 Parent(s): 067b22c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -5
Dockerfile CHANGED
@@ -20,11 +20,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
20
  RUN npm install -g @anthropic-ai/claude-code @cloudcli-ai/cloudcli task-master-ai pnpm \
21
  && npm cache clean --force
22
 
23
- # 2. 精准定位 cli.js 并去除 root 权限退出逻辑
24
- RUN CLI_PATH=$(node -e 'console.log(require("path").dirname(require.resolve("@anthropic-ai/claude-code/package.json")) + "/cli.js")') && \
25
- sed -i 's/cannot be used with root\/sudo privileges for security reasons/bypass root/g' "$CLI_PATH" && \
26
- sed -i 's/process\.exit(1)/ /* bypass */ /g' "$CLI_PATH"
27
-
 
28
  # 3. 安装官方 Cursor CLI,并使用【软链接】暴露到全局 PATH(保持 index.js 相对路径不破坏)
29
  RUN curl -fsSL https://cursor.com/install | bash && \
30
  chmod -R 755 /root/.local && \
 
20
  RUN npm install -g @anthropic-ai/claude-code @cloudcli-ai/cloudcli task-master-ai pnpm \
21
  && npm cache clean --force
22
 
23
+ # 2. 包装 claude 可执行文件,启动时无条件注入沙箱变量
24
+ RUN CLAUDE_BIN=$(which claude) && \
25
+ mv "$CLAUDE_BIN" "${CLAUDE_BIN}.real" && \
26
+ printf '#!/bin/sh\nexport IS_SANDBOX=1\nexport CLAUDE_CODE_BUBBLEWRAP=1\nexec "%s.real" "$@"\n' "$CLAUDE_BIN" > "$CLAUDE_BIN" && \
27
+ chmod +x "$CLAUDE_BIN"
28
+
29
  # 3. 安装官方 Cursor CLI,并使用【软链接】暴露到全局 PATH(保持 index.js 相对路径不破坏)
30
  RUN curl -fsSL https://cursor.com/install | bash && \
31
  chmod -R 755 /root/.local && \