davisc1/claw
0
1# OpenClaw Gateway for Hugging Face Spaces2# Lightweight npm-package deployment to avoid HF Space source-build OOMs.3 4FROM node:22-bookworm5 6ARG OPENCLAW_VERSION=2026.3.117 8RUN apt-get update && \9 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl dnsutils git && \10 apt-get clean && rm -rf /var/lib/apt/lists/*11 12ENV NODE_ENV=production13ENV NPM_CONFIG_UPDATE_NOTIFIER=false14ENV NPM_CONFIG_FUND=false15ENV NPM_CONFIG_AUDIT=false16ENV OPENCLAW_TELEGRAM_DISABLE_AUTO_SELECT_FAMILY=117ENV OPENCLAW_TELEGRAM_DNS_RESULT_ORDER=ipv4first18 19RUN npm install -g openclaw@${OPENCLAW_VERSION} @google/gemini-cli20 21WORKDIR /app22COPY setup-hf-config.mjs /app/setup-hf-config.mjs23COPY resolve-telegram-host.mjs /app/resolve-telegram-host.mjs24COPY resolve-discord-host.mjs /app/resolve-discord-host.mjs25COPY discord-bot-init.mjs /app/discord-bot-init.mjs26COPY discord-pairing-approve.mjs /app/discord-pairing-approve.mjs27COPY discord-startup-notify.mjs /app/discord-startup-notify.mjs28COPY import-auth-profiles.mjs /app/import-auth-profiles.mjs29COPY startup-notify.mjs /app/startup-notify.mjs30COPY sync-external-storage.mjs /app/sync-external-storage.mjs31 32EXPOSE 786033 34RUN printf '%s\n' \35 '#!/bin/sh' \36 'set -e' \37 'run_optional() {' \38 ' step="$1"' \39 ' shift' \40 ' echo "[openclaw-entrypoint] step=${step} status=start"' \41 ' if "$@"; then' \42 ' echo "[openclaw-entrypoint] step=${step} status=ok"' \43 ' else' \44 ' code=$?' \45 ' echo "[openclaw-entrypoint] step=${step} status=failed exit=${code} (continuing)"' \46 ' fi' \47 '}' \48 'echo "[openclaw-entrypoint] status=start node=$(node --version 2>/dev/null || echo missing) openclaw=$(openclaw --version 2>/dev/null || echo missing)"' \49 'if mkdir -p /data/.openclaw 2>/dev/null; then' \50 ' export OPENCLAW_HOME=/data' \51 'else' \52 ' export OPENCLAW_HOME=/home/user' \53 ' mkdir -p /home/user/.openclaw' \54 'fi' \55 'echo "[openclaw-entrypoint] openclaw_home=${OPENCLAW_HOME}"' \56 'if [ -n "${OPENCLAW_TELEGRAM_PROXY}" ]; then' \57 ' export HTTPS_PROXY="${HTTPS_PROXY:-$OPENCLAW_TELEGRAM_PROXY}"' \58 ' export HTTP_PROXY="${HTTP_PROXY:-$OPENCLAW_TELEGRAM_PROXY}"' \59 ' export ALL_PROXY="${ALL_PROXY:-$OPENCLAW_TELEGRAM_PROXY}"' \60 ' echo "[openclaw-entrypoint] telegram_proxy=1"' \61 'fi' \62 'run_optional resolve-telegram-host node /app/resolve-telegram-host.mjs' \63 'run_optional resolve-discord-host node /app/resolve-discord-host.mjs' \64 'echo "[openclaw-entrypoint] step=setup-hf-config status=start"' \65 'node /app/setup-hf-config.mjs' \66 'echo "[openclaw-entrypoint] step=setup-hf-config status=ok"' \67 'run_optional discord-bot-init node /app/discord-bot-init.mjs' \68 'echo "[openclaw-entrypoint] step=import-auth-profiles status=start"' \69 'node /app/import-auth-profiles.mjs' \70 'echo "[openclaw-entrypoint] step=import-auth-profiles status=ok"' \71 'run_optional startup-notify node /app/startup-notify.mjs' \72 'echo "[openclaw-entrypoint] step=discord-pairing-approve status=start background=1"' \73 'node /app/discord-pairing-approve.mjs 2>&1 &' \74 'run_optional discord-startup-notify node /app/discord-startup-notify.mjs' \75 'install_skill() {' \76 ' skill="$1"' \77 ' run_optional "skills-add:${skill}" npx --yes skills add "$skill" --agent "github-copilot" --yes' \78 '}' \79 'if [ "${OPENCLAW_AUTO_INSTALL_SKILLS:-1}" = "1" ]; then' \80 ' echo "[openclaw-entrypoint] step=skills-add status=start background=1"' \81 ' (' \82 ' install_skill "charon-fan/agent-playbook@self-improving-agent"' \83 ' install_skill "useai-pro/openclaw-skills-security@skill-vetter"' \84 ' install_skill "theagentservice/skills@openclaw-backup"' \85 ' install_skill "epiral/bb-browser@bb-browser"' \86 ' install_skill "vercel-labs/agent-browser@agent-browser"' \87 ' install_skill "joeseesun/opencli-skill@opencli"' \88 ' install_skill "aradotso/trending-skills@openclaw-control-center"' \89 ' echo "[openclaw-entrypoint] step=skills-add status=done"' \90 ' ) 2>&1 &' \91 'fi' \92 'if [ "${OPENCLAW_ENABLE_GEMINI_CLI_AUTH:-1}" = "1" ]; then' \93 ' echo "[openclaw-entrypoint] step=enable-gemini-cli-auth status=start"' \94 ' if openclaw plugins enable google-gemini-cli-auth >/tmp/openclaw-gemini-cli.log 2>&1; then' \95 ' echo "[openclaw-entrypoint] step=enable-gemini-cli-auth status=ok log=/tmp/openclaw-gemini-cli.log"' \96 ' else' \97 ' code=$?' \98 ' echo "[openclaw-entrypoint] step=enable-gemini-cli-auth status=failed exit=${code} log=/tmp/openclaw-gemini-cli.log (continuing)"' \99 ' fi' \100 'fi' \101 'if [ -n "${SUPABASE_URL}" ] && [ -n "${SUPABASE_KEY}" ]; then' \102 ' echo "[openclaw-entrypoint] step=sync-external-storage status=start background=1"' \103 ' node /app/sync-external-storage.mjs 2>&1 &' \104 'fi' \105 'echo "[openclaw-entrypoint] step=gateway status=exec port=7860 bind=lan"' \106 'exec openclaw gateway --allow-unconfigured --bind lan --port 7860 "$@"' \107 > /app/entrypoint.sh \108 && chmod +x /app/entrypoint.sh109 110RUN mkdir -p /home/user && chown -R node:node /app /home/user111 112ENTRYPOINT ["/app/entrypoint.sh"]113 