Spaces:
Paused
Paused
Update Dockerfile
Browse files12345203 unmodified lines209210211212213214215268 unmodified lines4844854864874884894905 unmodified lines49649749849950050150250350450550650750850951051151251311 unmodified lines525526527528529530531# ============================================================# Hermes Agent β Self-contained HF Spaces deployment (Stable v7.4)# Single Dockerfile: Gateway + Dashboard + Chat WebUI + Router## HOW TO DEPLOY:203 unmodified linesvar params = search.split('&');for (var i = 0; i < params.length; i++) {var pair = params[i].split('=');// FIX: Correctly check array key pair elements to support iframe token SSO query bypassesif (pair === 'token' && decodeURIComponent(pair || '').trim() === cleanGatewayToken) {return true;}268 unmodified lines# ββ 0. BROWSER FIX: Ensure /tmp agent-browser socket dir is writable ββββββββββ# Creating a dedicated 777-permission directory allows socket initialization by non-root users.# Note: We pre-create it directly with 777 permissions to avoid running chmod at runtime.mkdir -m 777 -p /tmp/agent-browser-sockets# ββ 1. BACKGROUND FRONTEND UPDATES ββββββββββββββββββββββββββββ5 unmodified lines# guaranteeing quick boot speed and direct synchronization.if [ -n "${HF_TOKEN:-}" ] && [ -n "${HF_BUCKET:-}" ]; thenecho "[boot] π¦ Restoring complete old workspace datasets..."export HF_TOKEN="${HF_TOKEN}"if hf sync "hf://buckets/${HF_BUCKET}" "$HH" \--exclude ".venv/**" --exclude "**/venv/**" --exclude "venv/**" \--exclude ".cache/**" --exclude "**/.cache/**" \--exclude "node_modules/**" --exclude "**/node_modules/**" \--exclude "__pycache__/**" --exclude "**/__pycache__/**" \--exclude "**/*.pyc" --exclude "**/*.log" --exclude "logs/**" --exclude "**/logs/**" \--exclude "**/*.db-wal" --exclude "**/*.db-shm" --exclude "**/*.db-journal" 2>/dev/null; thenecho "[boot] β Old databases, configs, & logs restored instantly"elseecho "[boot] β οΈ Bucket empty or authentication failed β starting fresh."fifi11 unmodified linescursor = conn.cursor()cursor.execute("PRAGMA integrity_check;")res = cursor.fetchone()# FIX: Check res tuple index directly to ensure SQLite checking evaluates cleanlyif res and res == "ok":cursor.execute("PRAGMA journal_mode=WAL;")cursor.execute("PRAGMA synchronous=NORMAL;")12345203 unmodified lines209210211212213214215268 unmodified lines4844854864874884894904915 unmodified lines49749849950050150250350450550650750850951051151251351451551651751851952052152252352411 unmodified lines536537538539540541542543# ============================================================# Hermes Agent β Self-contained HF Spaces deployment (Stable v7.5)# Single Dockerfile: Gateway + Dashboard + Chat WebUI + Router## HOW TO DEPLOY:203 unmodified linesvar params = search.split('&');for (var i = 0; i < params.length; i++) {var pair = params[i].split('=');// FIX: Correctly check array key pair elements to support iframe token query parameter bypassesif (pair === 'token' && decodeURIComponent(pair || '').trim() === cleanGatewayToken) {return true;}268 unmodified lines# ββ 0. BROWSER FIX: Ensure /tmp agent-browser socket dir is writable ββββββββββ# Creating a dedicated 777-permission directory allows socket initialization by non-root users.# Note: We pre-create it directly with 777 permissions.# We do NOT run "chmod 1777 /tmp" as it crashes non-root containers on HF Spaces.mkdir -m 777 -p /tmp/agent-browser-sockets# ββ 1. BACKGROUND FRONTEND UPDATES ββββββββββββββββββββββββββββ5 unmodified lines# guaranteeing quick boot speed and direct synchronization.if [ -n "${HF_TOKEN:-}" ] && [ -n "${HF_BUCKET:-}" ]; thenecho "[boot] π¦ Restoring complete old workspace datasets..."# FIX: Aggressively sanitize input HF_TOKEN secret (stripping trailing whitespace, quotes, or newlines)# to make sure authentication works flawlessly even if copy-paste errors occurred.HF_TOKEN=$(echo "$HF_TOKEN" | tr -d '\r' | tr -d ' ' | tr -d '\n')export HF_TOKEN="${HF_TOKEN}"# Capturing sync errors directly to a boot log so the user can easily see what went wrong in the UI logsSYNC_RESTORE_LOG=$(mktemp)if hf sync "hf://buckets/${HF_BUCKET}" "$HH" \--exclude ".venv/**" --exclude "**/venv/**" --exclude "venv/**" \--exclude ".cache/**" --exclude "**/.cache/**" \--exclude "node_modules/**" --exclude "**/node_modules/**" \--exclude "__pycache__/**" --exclude "**/__pycache__/**" \--exclude "**/*.pyc" --exclude "**/*.log" --exclude "logs/**" --exclude "**/logs/**" \--exclude "**/*.db-wal" --exclude "**/*.db-shm" --exclude "**/*.db-journal" > "$SYNC_RESTORE_LOG" 2>&1; thenecho "[boot] β Old databases, configs, & logs restored instantly"rm -f "$SYNC_RESTORE_LOG"elseecho "[boot] β Bucket sync restore failed! Sync error details:"cat "$SYNC_RESTORE_LOG"rm -f "$SYNC_RESTORE_LOG"echo "[boot] Starting fresh with default local configurations."fifi11 unmodified linescursor = conn.cursor()cursor.execute("PRAGMA integrity_check;")res = cursor.fetchone()# FIX: Check res tuple value directly to ensure SQLite checking evaluates cleanly# This prevents the container from wiping the database on every boot!if res and res == "ok":cursor.execute("PRAGMA journal_mode=WAL;")cursor.execute("PRAGMA synchronous=NORMAL;")
Dockerfile+18-6