lxui commited on
Commit
2b18df8
·
verified ·
1 Parent(s): e3be79a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -18
Dockerfile CHANGED
@@ -12,33 +12,24 @@ RUN apt-get update && apt-get install -y \
12
  g++ \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # 安装 openclaw(npm 会自动处理可执行文件)
16
  RUN npm install -g openclaw
17
 
18
- # 确保 npm 全局 binPATH 中(通常已包含,但显式设置无害)
19
- ENV NPM_CONFIG_PREFIX=/usr/local
20
- ENV PATH="/usr/local/bin:${PATH}"
21
 
22
- # 创建 openclaw 配置文件(位于 openclaw 默认读取的路径)
23
- RUN mkdir -p /root/.config/openclaw && \
24
- echo '{"defaultAgent":"claude","agents":{"claude":{"provider":"anthropic","model":"claude-3-sonnet-20240229","apiKey":""}}}' > /root/.config/openclaw/openclaw.json
25
 
26
- # 验证 openclaw 是否能正常运行(可选,用于调试)
27
- RUN openclaw --version
28
-
29
- # 克隆 edict 仓库
30
  RUN git clone https://github.com/cft0808/edict.git /app/edict
31
  WORKDIR /app/edict
32
 
33
- # 设置环境变量,确保 install.sh 能找到配置文件
34
- ENV HOME=/root
35
- ENV OPENCLAW_CONFIG=/root/.config/openclaw/openclaw.json
36
 
37
- # 安装脚本
38
- RUN ./install.sh
39
 
40
- # 创建运行时启动脚本(与之前相同)
41
- RUN printf '#!/bin/bash\nexport PATH="/usr/local/bin:$PATH"\nmkdir -p /root/.config/openclaw\ncat > /root/.config/openclaw/openclaw.json << EOF\n{\n "defaultAgent": "${DEFAULT_AGENT:-claude}",\n "agents": {\n "claude": {\n "provider": "anthropic",\n "model": "${CLAUDE_MODEL:-claude-3-sonnet-20240229}",\n "apiKey": "${ANTHROPIC_API_KEY:-}"\n }\n }\n}\nEOF\ncd /app/edict\nbash scripts/run_loop.sh &\npython3 dashboard/server.py\n' > /app/start.sh && chmod +x /app/start.sh
42
 
43
  EXPOSE 7891
44
  CMD ["/app/start.sh"]
 
12
  g++ \
13
  && rm -rf /var/lib/apt/lists/*
14
 
 
15
  RUN npm install -g openclaw
16
 
17
+ ENV PATH="/usr/local/bin:$PATH"
 
 
18
 
19
+ # 创建 openclaw 包装器
20
+ RUN printf '#!/usr/bin/env node\nrequire("openclaw");\n' > /usr/local/bin/openclaw && chmod +x /usr/local/bin/openclaw
 
21
 
 
 
 
 
22
  RUN git clone https://github.com/cft0808/edict.git /app/edict
23
  WORKDIR /app/edict
24
 
25
+ # 创建 openclaw 配置目录和空配置文件(install.sh 会填充内容)
26
+ RUN mkdir -p /root/.openclaw && \
27
+ echo '{}' > /root/.openclaw/openclaw.json
28
 
29
+ # install.sh(它会注册 agents 到 openclaw.json)
30
+ RUN bash -c 'export PATH="/usr/local/bin:$PATH" && ./install.sh'
31
 
32
+ RUN printf '#!/bin/bash\nexport PATH="/usr/local/bin:$PATH"\ncd /app/edict\nbash scripts/run_loop.sh &\npython3 dashboard/server.py\n' > /app/start.sh && chmod +x /app/start.sh
 
33
 
34
  EXPOSE 7891
35
  CMD ["/app/start.sh"]