tao-shen Claude Opus 4.6 commited on
Commit
ebf240b
Β·
1 Parent(s): ac5bf04

fix: remove chmod /etc/hosts (read-only in build), run DNS sync before app

Browse files

Removed chmod 666 /etc/hosts from Dockerfile (HF build filesystem is
read-only). Changed DNS resolution from background to blocking so
/tmp/dns-resolved.json and /etc/hosts entries are ready before OpenClaw
starts β€” needed for undici/fetch which bypasses dns.lookup patching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. Dockerfile +0 -1
  2. scripts/entrypoint.sh +6 -10
Dockerfile CHANGED
@@ -14,7 +14,6 @@ RUN echo "[build][layer1] System deps + tools..." && START=$(date +%s) \
14
  && chown node:node /app \
15
  && mkdir -p /home/node/.openclaw/workspace /home/node/.openclaw/credentials \
16
  && chown -R node:node /home/node \
17
- && chmod 666 /etc/hosts \
18
  && echo "[build][layer1] System deps + tools: $(($(date +%s) - START))s"
19
 
20
  # ── εˆ‡ζ’εˆ° node η”¨ζˆ·οΌˆεŽη»­ζ‰€ζœ‰ζ“δ½œιƒ½δ»₯ node θΊ«δ»½οΌŒζ— ιœ€ chown)───────────────
 
14
  && chown node:node /app \
15
  && mkdir -p /home/node/.openclaw/workspace /home/node/.openclaw/credentials \
16
  && chown -R node:node /home/node \
 
17
  && echo "[build][layer1] System deps + tools: $(($(date +%s) - START))s"
18
 
19
  # ── εˆ‡ζ’εˆ° node η”¨ζˆ·οΌˆεŽη»­ζ‰€ζœ‰ζ“δ½œιƒ½δ»₯ node θΊ«δ»½οΌŒζ— ιœ€ chown)───────────────
scripts/entrypoint.sh CHANGED
@@ -6,15 +6,12 @@ BOOT_START=$(date +%s)
6
  echo "[entrypoint] OpenClaw HuggingFace Spaces Entrypoint"
7
  echo "[entrypoint] ======================================="
8
 
9
- # ── DNS pre-resolution (run in BACKGROUND β€” was 121s blocking) ──────────────
10
- echo "[entrypoint] Resolving WhatsApp & Telegram domains via DNS-over-HTTPS (background)..."
11
  DNS_START=$(date +%s)
12
- (
13
- python3 /home/node/scripts/dns-resolve.py /tmp/dns-resolved.json 2>&1
14
- DNS_END=$(date +%s)
15
- echo "[TIMER] DNS pre-resolve (background): $((DNS_END - DNS_START))s"
16
- ) &
17
- DNS_PID=$!
18
 
19
  # ── Node.js memory limit (only if explicitly set) ─────────────────────────
20
  if [ -n "$NODE_MEMORY_LIMIT" ]; then
@@ -60,7 +57,6 @@ if [ -f /app/openclaw/.version ]; then
60
  echo "[entrypoint] OpenClaw version: $OPENCLAW_VERSION"
61
  fi
62
 
63
- # ── Start OpenClaw via sync_hf.py (don't wait for DNS β€” it runs in bg) ─────
64
  echo "[entrypoint] Starting OpenClaw via sync_hf.py..."
65
- echo "[entrypoint] DNS resolution running in background (PID $DNS_PID), app will use it when ready"
66
  exec python3 -u /home/node/scripts/sync_hf.py
 
6
  echo "[entrypoint] OpenClaw HuggingFace Spaces Entrypoint"
7
  echo "[entrypoint] ======================================="
8
 
9
+ # ── DNS pre-resolution (BLOCKING β€” needed before app starts) ──────────────
10
+ echo "[entrypoint] Resolving WhatsApp & Telegram domains via DNS-over-HTTPS..."
11
  DNS_START=$(date +%s)
12
+ python3 /home/node/scripts/dns-resolve.py /tmp/dns-resolved.json 2>&1
13
+ DNS_END=$(date +%s)
14
+ echo "[TIMER] DNS pre-resolve: $((DNS_END - DNS_START))s"
 
 
 
15
 
16
  # ── Node.js memory limit (only if explicitly set) ─────────────────────────
17
  if [ -n "$NODE_MEMORY_LIMIT" ]; then
 
57
  echo "[entrypoint] OpenClaw version: $OPENCLAW_VERSION"
58
  fi
59
 
60
+ # ── Start OpenClaw via sync_hf.py ─────────────────────────────────────────
61
  echo "[entrypoint] Starting OpenClaw via sync_hf.py..."
 
62
  exec python3 -u /home/node/scripts/sync_hf.py