8900 commited on
Commit
29b1a30
·
verified ·
1 Parent(s): 4442b30

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -22
Dockerfile CHANGED
@@ -3,15 +3,17 @@ FROM ghcr.io/openclaw/openclaw:latest
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
8
- 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'); \
@@ -23,7 +25,8 @@ RUN node -e " \
23
  } catch(e) { return []; } \
24
  } \
25
  const bundles = findBundles(); \
26
- if (bundles.length === 0) { console.log('[patch] No bundle found'); process.exit(0); } \
 
27
  let patched = 0; \
28
  bundles.forEach(function(file) { \
29
  let src = fs.readFileSync(file, 'utf-8'); \
@@ -32,8 +35,8 @@ RUN node -e " \
32
  } \
33
  const patterns = [ \
34
  ['{prefix:\"channels\",kind:', '{prefix:\"meta\",kind:\"none\"},{prefix:\"channels\",kind:'], \
35
- ['{prefix:\"update\",kind:', '{prefix:\"meta\",kind:\"none\"},{prefix:\"update\",kind:'], \
36
- ['{prefix:\"agents\",kind:', '{prefix:\"meta\",kind:\"none\"},{prefix:\"agents\",kind:'] \
37
  ]; \
38
  let applied = false; \
39
  for (let i = 0; i < patterns.length; i++) { \
@@ -42,23 +45,25 @@ RUN node -e " \
42
  applied = true; break; \
43
  } \
44
  } \
45
- if (applied) { \
46
- fs.writeFileSync(file, src, 'utf-8'); \
47
- console.log('[patch] Patched: ' + file); \
48
- patched++; \
49
- } else { \
50
- console.log('[patch] Pattern not found in: ' + file); \
51
  } \
52
  }); \
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
 
 
 
 
 
60
 
61
- USER root
62
 
63
  EXPOSE 7860
64
 
 
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
8
+ COPY entrypoint.sh /app/entrypoint.sh
9
+ COPY hf-sync-manager.mjs /app/hf-sync-manager.mjs
10
+ COPY security-check.sh /app/security-check.sh
11
+ COPY diagnose.sh /app/diagnose.sh
12
 
13
+ # PATCH: fix meta.lastTouchedAt triggering unnecessary gateway restarts
14
  # Issue: https://github.com/openclaw/openclaw/issues/11744
15
+ # meta.lastTouchedAt is updated on every config write, but it is not in
16
+ # BASE_RELOAD_RULES, so every config save triggers a full gateway restart.
17
  # Fix: inject {prefix:"meta",kind:"none"} into BASE_RELOAD_RULES.
18
  RUN node -e " \
19
  const fs = require('fs'); \
 
25
  } catch(e) { return []; } \
26
  } \
27
  const bundles = findBundles(); \
28
+ if (bundles.length === 0) { console.log('[patch] No bundle found - skipping'); process.exit(0); } \
29
+
30
  let patched = 0; \
31
  bundles.forEach(function(file) { \
32
  let src = fs.readFileSync(file, 'utf-8'); \
 
35
  } \
36
  const patterns = [ \
37
  ['{prefix:\"channels\",kind:', '{prefix:\"meta\",kind:\"none\"},{prefix:\"channels\",kind:'], \
38
+ ['{prefix:\"update\",kind:', '{prefix:\"meta\",kind:\"none\"},{prefix:\"update\",kind:'], \
39
+ ['{prefix:\"agents\",kind:', '{prefix:\"meta\",kind:\"none\"},{prefix:\"agents\",kind:'] \
40
  ]; \
41
  let applied = false; \
42
  for (let i = 0; i < patterns.length; i++) { \
 
45
  applied = true; break; \
46
  } \
47
  } \
48
+ if (applied) { fs.writeFileSync(file, src, 'utf-8'); \
49
+ console.log('[patch] Patched: ' + file); patched++; } \
50
+ else { console.log('[patch] Pattern not found: ' + file); \
 
 
 
51
  } \
52
  }); \
53
+ console.log('[patch] Done. Patched: ' + patched + '/' + bundles.length); \
54
  " || echo "[patch] Non-fatal: patch step failed"
55
 
56
+ RUN chmod +x /app/entrypoint.sh \
57
+ /app/security-check.sh && \
58
+ mkdir -p /home/user && \
59
+ chown -R node:node /home/user && \
60
+ chown node:node /app/entrypoint.sh \
61
+ /app/hf-sync-manager.mjs \
62
+ /app/security-check.sh \
63
+ /app/openclaw-template.json \
64
+ /app/spaces/huggingface/setup-hf-config.mjs
65
 
66
+ USER node
67
 
68
  EXPOSE 7860
69