Update Dockerfile
Browse files- Dockerfile +30 -5
Dockerfile
CHANGED
|
@@ -2,6 +2,36 @@ FROM ghcr.io/openclaw/openclaw:latest
|
|
| 2 |
|
| 3 |
USER root
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# Copy Space repo files into container
|
| 6 |
COPY openclaw.json /app/openclaw-template.json
|
| 7 |
COPY setup-hf-config.mjs /app/spaces/huggingface/setup-hf-config.mjs
|
|
@@ -9,10 +39,6 @@ COPY entrypoint.sh /app/entrypoint.sh
|
|
| 9 |
COPY security-check.sh /app/security-check.sh
|
| 10 |
|
| 11 |
# PATCH: suppress meta.lastTouchedAt from triggering gateway restarts
|
| 12 |
-
# Issue: https://github.com/openclaw/openclaw/issues/11744
|
| 13 |
-
# Every config write updates meta.lastTouchedAt which is not in
|
| 14 |
-
# BASE_RELOAD_RULES, causing a full gateway restart on every save.
|
| 15 |
-
# Fix: inject {prefix:"meta",kind:"none"} into BASE_RELOAD_RULES.
|
| 16 |
RUN node -e " \
|
| 17 |
const fs = require('fs'); \
|
| 18 |
const { execSync } = require('child_process'); \
|
|
@@ -53,7 +79,6 @@ RUN node -e " \
|
|
| 53 |
console.log('[patch] Done. ' + patched + '/' + bundles.length + ' file(s) patched'); \
|
| 54 |
" || echo "[patch] Non-fatal: patch step failed"
|
| 55 |
|
| 56 |
-
# Ensure /data is world-writable so HF Storage Bucket mount is accessible
|
| 57 |
RUN chmod +x /app/entrypoint.sh /app/security-check.sh && \
|
| 58 |
mkdir -p /data && chmod 777 /data && \
|
| 59 |
mkdir -p /home/user && chmod 777 /home/user
|
|
|
|
| 2 |
|
| 3 |
USER root
|
| 4 |
|
| 5 |
+
# ----------------------------------------------------------------
|
| 6 |
+
# Remove Baileys (WhatsApp automation lib) from the base image.
|
| 7 |
+
# OpenClaw bundles it for WhatsApp channel support, but HF policy
|
| 8 |
+
# prohibits third-party messaging automation. Purge it completely.
|
| 9 |
+
# ----------------------------------------------------------------
|
| 10 |
+
RUN find /app /usr/local/lib /root -type d \( \
|
| 11 |
+
-name "baileys" \
|
| 12 |
+
-o -name "@whiskeysockets" \
|
| 13 |
+
-o -name "whatsapp-web*" \
|
| 14 |
+
\) -exec rm -rf {} + 2>/dev/null || true && \
|
| 15 |
+
find /app /usr/local/lib /root -name "package.json" ! -path "*/\.*" \
|
| 16 |
+
-exec sh -c ' \
|
| 17 |
+
node -e " \
|
| 18 |
+
var fs=require(\"fs\"); \
|
| 19 |
+
var p=process.argv[1]; \
|
| 20 |
+
try { \
|
| 21 |
+
var j=JSON.parse(fs.readFileSync(p,\"utf-8\")); \
|
| 22 |
+
var changed=false; \
|
| 23 |
+
[\"dependencies\",\"devDependencies\",\"optionalDependencies\"].forEach(function(k){ \
|
| 24 |
+
if(!j[k]) return; \
|
| 25 |
+
[\"baileys\",\"@whiskeysockets/baileys\",\"@adiwajshing/baileys\"].forEach(function(b){ \
|
| 26 |
+
if(j[k][b]){ delete j[k][b]; changed=true; \
|
| 27 |
+
console.log(\"[baileys-purge] Removed \"+b+\" from \"+p); } \
|
| 28 |
+
}); \
|
| 29 |
+
}); \
|
| 30 |
+
if(changed) fs.writeFileSync(p,JSON.stringify(j,null,2)); \
|
| 31 |
+
} catch(e){} \
|
| 32 |
+
" "$1" \
|
| 33 |
+
' _ {} \; 2>/dev/null || true
|
| 34 |
+
|
| 35 |
# Copy Space repo files into container
|
| 36 |
COPY openclaw.json /app/openclaw-template.json
|
| 37 |
COPY setup-hf-config.mjs /app/spaces/huggingface/setup-hf-config.mjs
|
|
|
|
| 39 |
COPY security-check.sh /app/security-check.sh
|
| 40 |
|
| 41 |
# PATCH: suppress meta.lastTouchedAt from triggering gateway restarts
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
RUN node -e " \
|
| 43 |
const fs = require('fs'); \
|
| 44 |
const { execSync } = require('child_process'); \
|
|
|
|
| 79 |
console.log('[patch] Done. ' + patched + '/' + bundles.length + ' file(s) patched'); \
|
| 80 |
" || echo "[patch] Non-fatal: patch step failed"
|
| 81 |
|
|
|
|
| 82 |
RUN chmod +x /app/entrypoint.sh /app/security-check.sh && \
|
| 83 |
mkdir -p /data && chmod 777 /data && \
|
| 84 |
mkdir -p /home/user && chmod 777 /home/user
|