Update Dockerfile
Browse files- Dockerfile +21 -5
Dockerfile
CHANGED
|
@@ -5,7 +5,7 @@ FROM registry.cn-hangzhou.aliyuncs.com/chatwiki/chatclaw:latest AS chatclaw
|
|
| 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,7 +18,6 @@ ENV PORT=7860 \
|
|
| 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
|
|
@@ -35,8 +34,11 @@ set -e
|
|
| 35 |
|
| 36 |
python3 /usr/local/bin/sync.py restore
|
| 37 |
|
| 38 |
-
# 清理 Telegram 残留(
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
mkdir -p /root/.openclaw/sessions
|
| 42 |
mkdir -p /root/.openclaw/workspace
|
|
@@ -90,7 +92,7 @@ cat > /root/.openclaw/openclaw.json <<EOF2
|
|
| 90 |
},
|
| 91 |
"gateway": {
|
| 92 |
"mode": "local",
|
| 93 |
-
"bind": "
|
| 94 |
"port": 8081,
|
| 95 |
"trustedProxies": ["0.0.0.0/0", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
|
| 96 |
"auth": { "mode": "token", "token": "$OPENCLAW_GATEWAY_PASSWORD" },
|
|
@@ -117,10 +119,24 @@ openclaw doctor --fix
|
|
| 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=$!
|
|
|
|
| 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 netcat-openbsd \
|
| 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 |
COPY --from=chatclaw /server /usr/local/bin/chatclaw-server
|
| 22 |
COPY --from=chatclaw /frontend /app/chatclaw-frontend
|
| 23 |
RUN chmod +x /usr/local/bin/chatclaw-server
|
|
|
|
| 34 |
|
| 35 |
python3 /usr/local/bin/sync.py restore
|
| 36 |
|
| 37 |
+
# 清理 Telegram 残留(请补充完整)
|
| 38 |
+
rm -rf /root/.openclaw/agents/main/agent/channels/telegram
|
| 39 |
+
rm -rf /root/.openclaw/credentials/telegram
|
| 40 |
+
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json
|
| 41 |
+
find /root/.openclaw -name "*telegram*" -exec rm -rf {} + 2>/dev/null || true
|
| 42 |
|
| 43 |
mkdir -p /root/.openclaw/sessions
|
| 44 |
mkdir -p /root/.openclaw/workspace
|
|
|
|
| 92 |
},
|
| 93 |
"gateway": {
|
| 94 |
"mode": "local",
|
| 95 |
+
"bind": "loopback",
|
| 96 |
"port": 8081,
|
| 97 |
"trustedProxies": ["0.0.0.0/0", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
|
| 98 |
"auth": { "mode": "token", "token": "$OPENCLAW_GATEWAY_PASSWORD" },
|
|
|
|
| 119 |
openclaw gateway run --port 8081 &
|
| 120 |
OPENCLAW_PID=$!
|
| 121 |
|
| 122 |
+
# 等待网关就绪
|
| 123 |
+
echo "Waiting for OpenClaw gateway on 8081..."
|
| 124 |
+
for i in $(seq 1 30); do
|
| 125 |
+
if nc -z 127.0.0.1 8081 2>/dev/null; then
|
| 126 |
+
echo "OpenClaw gateway ready."
|
| 127 |
+
break
|
| 128 |
+
fi
|
| 129 |
+
echo "Attempt $i/30: waiting..."
|
| 130 |
+
sleep 1
|
| 131 |
+
done
|
| 132 |
+
|
| 133 |
# 启动 ChatClaw 服务(内部 8080)
|
| 134 |
/usr/local/bin/chatclaw-server --port 8080 &
|
| 135 |
CHATCLAW_PID=$!
|
| 136 |
|
| 137 |
+
# 等待 ChatClaw 就绪
|
| 138 |
+
sleep 3
|
| 139 |
+
|
| 140 |
# 端口转发 7860 -> ChatClaw 的 8080
|
| 141 |
socat TCP-LISTEN:7860,fork,reuseaddr TCP:127.0.0.1:8080 &
|
| 142 |
SOCAT_PID=$!
|