Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +15 -8
Dockerfile
CHANGED
|
@@ -19,6 +19,9 @@ ENV PORT=7860 \
|
|
| 19 |
OPENCLAW_GATEWAY_MODE=local \
|
| 20 |
HOME=/root
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
# ========= 2. 完整的 sync.py 备份恢复脚本 =========
|
| 23 |
RUN cat > /usr/local/bin/sync.py << 'SYNC_EOF'
|
| 24 |
import os, sys, tarfile
|
|
@@ -85,7 +88,7 @@ SYNC_EOF
|
|
| 85 |
|
| 86 |
RUN chmod +x /usr/local/bin/sync.py
|
| 87 |
|
| 88 |
-
# ========= 3. 启动脚本 start-openclaw(
|
| 89 |
RUN cat > /usr/local/bin/start-openclaw << 'EOF'
|
| 90 |
#!/bin/bash
|
| 91 |
set -e
|
|
@@ -94,9 +97,13 @@ echo "Starting OpenClaw gateway..."
|
|
| 94 |
|
| 95 |
python3 /usr/local/bin/sync.py restore
|
| 96 |
|
|
|
|
| 97 |
rm -rf /root/.openclaw/agents/main/agent/channels/telegram
|
| 98 |
rm -rf /root/.openclaw/credentials/telegram
|
|
|
|
|
|
|
| 99 |
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json
|
|
|
|
| 100 |
|
| 101 |
mkdir -p /root/.openclaw/sessions
|
| 102 |
mkdir -p /root/.openclaw/workspace
|
|
@@ -124,7 +131,7 @@ else
|
|
| 124 |
API_TYPE="openai-completions"
|
| 125 |
fi
|
| 126 |
|
| 127 |
-
# 写入 openclaw.json(
|
| 128 |
cat > /root/.openclaw/openclaw.json <<EOF2
|
| 129 |
{
|
| 130 |
"models": {
|
|
@@ -165,6 +172,9 @@ cat > /root/.openclaw/openclaw.json <<EOF2
|
|
| 165 |
"enabled": true,
|
| 166 |
"dataDir": "/root/.openclaw/wechat-data",
|
| 167 |
"autoLogin": true
|
|
|
|
|
|
|
|
|
|
| 168 |
}
|
| 169 |
},
|
| 170 |
"browser": {
|
|
@@ -182,14 +192,11 @@ echo "=== end ==="
|
|
| 182 |
|
| 183 |
openclaw doctor --fix
|
| 184 |
|
|
|
|
| 185 |
(while true; do sleep 1800; python3 /usr/local/bin/sync.py backup; done) &
|
| 186 |
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
trap 'echo "Container stopping, running final backup..."; python3 /usr/local/bin/sync.py backup; kill $GATEWAY_PID 2>/dev/null' EXIT
|
| 191 |
-
|
| 192 |
-
wait $GATEWAY_PID
|
| 193 |
EOF
|
| 194 |
|
| 195 |
RUN chmod +x /usr/local/bin/start-openclaw
|
|
|
|
| 19 |
OPENCLAW_GATEWAY_MODE=local \
|
| 20 |
HOME=/root
|
| 21 |
|
| 22 |
+
# 设置环境变量,防止 doctor 自动启用 Telegram
|
| 23 |
+
ENV OPENCLAW_DISABLE_TELEGRAM=1
|
| 24 |
+
|
| 25 |
# ========= 2. 完整的 sync.py 备份恢复脚本 =========
|
| 26 |
RUN cat > /usr/local/bin/sync.py << 'SYNC_EOF'
|
| 27 |
import os, sys, tarfile
|
|
|
|
| 88 |
|
| 89 |
RUN chmod +x /usr/local/bin/sync.py
|
| 90 |
|
| 91 |
+
# ========= 3. 启动脚本 start-openclaw(禁用 Telegram + 前台 exec) =========
|
| 92 |
RUN cat > /usr/local/bin/start-openclaw << 'EOF'
|
| 93 |
#!/bin/bash
|
| 94 |
set -e
|
|
|
|
| 97 |
|
| 98 |
python3 /usr/local/bin/sync.py restore
|
| 99 |
|
| 100 |
+
# 彻底删除 Telegram 所有残留文件
|
| 101 |
rm -rf /root/.openclaw/agents/main/agent/channels/telegram
|
| 102 |
rm -rf /root/.openclaw/credentials/telegram
|
| 103 |
+
rm -rf /root/.openclaw/agents/main/agent/telegram*
|
| 104 |
+
rm -rf /root/.openclaw/agents/main/agent/channels/telegram*
|
| 105 |
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json
|
| 106 |
+
find /root/.openclaw -name "*telegram*" -exec rm -rf {} + 2>/dev/null || true
|
| 107 |
|
| 108 |
mkdir -p /root/.openclaw/sessions
|
| 109 |
mkdir -p /root/.openclaw/workspace
|
|
|
|
| 131 |
API_TYPE="openai-completions"
|
| 132 |
fi
|
| 133 |
|
| 134 |
+
# 写入 openclaw.json(显式禁用 telegram)
|
| 135 |
cat > /root/.openclaw/openclaw.json <<EOF2
|
| 136 |
{
|
| 137 |
"models": {
|
|
|
|
| 172 |
"enabled": true,
|
| 173 |
"dataDir": "/root/.openclaw/wechat-data",
|
| 174 |
"autoLogin": true
|
| 175 |
+
},
|
| 176 |
+
"telegram": {
|
| 177 |
+
"enabled": false
|
| 178 |
}
|
| 179 |
},
|
| 180 |
"browser": {
|
|
|
|
| 192 |
|
| 193 |
openclaw doctor --fix
|
| 194 |
|
| 195 |
+
# 启动定时备份(后台运行)
|
| 196 |
(while true; do sleep 1800; python3 /usr/local/bin/sync.py backup; done) &
|
| 197 |
|
| 198 |
+
# ✅ 前台运行 gateway(容器永不退出)
|
| 199 |
+
exec openclaw gateway run --port $PORT
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
EOF
|
| 201 |
|
| 202 |
RUN chmod +x /usr/local/bin/start-openclaw
|