Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +22 -22
Dockerfile
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM node:22-slim
|
| 2 |
|
| 3 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 4 |
-
git ca-certificates build-essential python3 python3-pip curl \
|
| 5 |
&& rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
RUN pip3 install --no-cache-dir huggingface_hub --break-system-packages
|
|
@@ -14,27 +18,25 @@ ENV PORT=7860 \
|
|
| 14 |
OPENCLAW_GATEWAY_MODE=local \
|
| 15 |
HOME=/root
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
EOF
|
| 21 |
-
|
| 22 |
-
# 复制 ChatClaw 可执行文件(从官方镜像提取)
|
| 23 |
-
COPY --from=registry.cn-hangzhou.aliyuncs.com/chatwiki/chatclaw:latest /server /usr/local/bin/chatclaw-server
|
| 24 |
-
COPY --from=registry.cn-hangzhou.aliyuncs.com/chatwiki/chatclaw:latest /frontend /app/chatclaw-frontend
|
| 25 |
RUN chmod +x /usr/local/bin/chatclaw-server
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
RUN cat > /usr/local/bin/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
#!/bin/bash
|
| 30 |
set -e
|
| 31 |
|
| 32 |
python3 /usr/local/bin/sync.py restore
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json
|
| 37 |
-
find /root/.openclaw -name "*telegram*" -exec rm -rf {} + 2>/dev/null || true
|
| 38 |
|
| 39 |
mkdir -p /root/.openclaw/sessions
|
| 40 |
mkdir -p /root/.openclaw/workspace
|
|
@@ -111,17 +113,15 @@ echo "=== end ==="
|
|
| 111 |
|
| 112 |
openclaw doctor --fix
|
| 113 |
|
| 114 |
-
# 启动 OpenClaw 网关(
|
| 115 |
openclaw gateway run --port 8081 &
|
| 116 |
OPENCLAW_PID=$!
|
| 117 |
|
| 118 |
-
# 启动 ChatClaw
|
| 119 |
-
export OPENCLAW_GATEWAY_URL=http://127.0.0.1:8081
|
| 120 |
-
# ChatClaw 可能也需要指定自己的端口,默认 8080
|
| 121 |
/usr/local/bin/chatclaw-server --port 8080 &
|
| 122 |
CHATCLAW_PID=$!
|
| 123 |
|
| 124 |
-
#
|
| 125 |
socat TCP-LISTEN:7860,fork,reuseaddr TCP:127.0.0.1:8080 &
|
| 126 |
SOCAT_PID=$!
|
| 127 |
|
|
@@ -133,7 +133,7 @@ trap 'echo "Container stopping, running final backup..."; python3 /usr/local/bin
|
|
| 133 |
wait $CHATCLAW_PID
|
| 134 |
EOF
|
| 135 |
|
| 136 |
-
RUN chmod +x /usr/local/bin/start
|
| 137 |
|
| 138 |
EXPOSE 7860
|
| 139 |
-
CMD ["/usr/local/bin/start
|
|
|
|
| 1 |
+
# 拉取 ChatClaw 镜像作为源
|
| 2 |
+
FROM registry.cn-hangzhou.aliyuncs.com/chatwiki/chatclaw:latest AS chatclaw
|
| 3 |
+
|
| 4 |
+
# 主镜像:OpenClaw 环境
|
| 5 |
FROM node:22-slim
|
| 6 |
|
| 7 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
+
git ca-certificates build-essential python3 python3-pip curl socat \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
RUN pip3 install --no-cache-dir huggingface_hub --break-system-packages
|
|
|
|
| 18 |
OPENCLAW_GATEWAY_MODE=local \
|
| 19 |
HOME=/root
|
| 20 |
|
| 21 |
+
# 复制 ChatClaw 文件
|
| 22 |
+
COPY --from=chatclaw /server /usr/local/bin/chatclaw-server
|
| 23 |
+
COPY --from=chatclaw /frontend /app/chatclaw-frontend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
RUN chmod +x /usr/local/bin/chatclaw-server
|
| 25 |
|
| 26 |
+
# 备份恢复脚本(请用你的完整 sync.py 替换此处)
|
| 27 |
+
RUN cat > /usr/local/bin/sync.py << 'SYNC_EOF'
|
| 28 |
+
# 这里放你完整的 sync.py 内容
|
| 29 |
+
SYNC_EOF
|
| 30 |
+
|
| 31 |
+
# 启动脚本
|
| 32 |
+
RUN cat > /usr/local/bin/start.sh << 'EOF'
|
| 33 |
#!/bin/bash
|
| 34 |
set -e
|
| 35 |
|
| 36 |
python3 /usr/local/bin/sync.py restore
|
| 37 |
|
| 38 |
+
# 清理 Telegram 残留(从原 OpenClaw 脚本中复制完整命令,请补充)
|
| 39 |
+
# ...
|
|
|
|
|
|
|
| 40 |
|
| 41 |
mkdir -p /root/.openclaw/sessions
|
| 42 |
mkdir -p /root/.openclaw/workspace
|
|
|
|
| 113 |
|
| 114 |
openclaw doctor --fix
|
| 115 |
|
| 116 |
+
# 启动 OpenClaw 网关(内部 8081)
|
| 117 |
openclaw gateway run --port 8081 &
|
| 118 |
OPENCLAW_PID=$!
|
| 119 |
|
| 120 |
+
# 启动 ChatClaw 服务(内部 8080)
|
|
|
|
|
|
|
| 121 |
/usr/local/bin/chatclaw-server --port 8080 &
|
| 122 |
CHATCLAW_PID=$!
|
| 123 |
|
| 124 |
+
# 端口转发 7860 -> ChatClaw 的 8080
|
| 125 |
socat TCP-LISTEN:7860,fork,reuseaddr TCP:127.0.0.1:8080 &
|
| 126 |
SOCAT_PID=$!
|
| 127 |
|
|
|
|
| 133 |
wait $CHATCLAW_PID
|
| 134 |
EOF
|
| 135 |
|
| 136 |
+
RUN chmod +x /usr/local/bin/start.sh
|
| 137 |
|
| 138 |
EXPOSE 7860
|
| 139 |
+
CMD ["/usr/local/bin/start.sh"]
|