# OpenClaw Official + Gemini + ALL Skills Templates + HF Spaces Full Fix FROM node:22-bookworm ARG OPENCLAW_REPO=https://github.com/openclaw/openclaw.git ARG OPENCLAW_REF=main RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates curl && \ apt-get clean && rm -rf /var/lib/apt/lists/* \ && curl -fsSL https://bun.sh/install | bash ENV PATH="/root/.bun/bin:${PATH}" RUN corepack enable WORKDIR /app RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . \ && pnpm install --frozen-lockfile \ && pnpm build ENV OPENCLAW_PREFER_PNPM=1 RUN pnpm ui:build ENV NODE_ENV=production EXPOSE 7860 # Setup script: Gemini + ALL Skills Templates + HF fixes RUN mkdir -p /app/spaces/huggingface && \ cat > /app/spaces/huggingface/setup-hf-config.mjs << 'EOF' #!/usr/bin/env node import fs from "node:fs"; import path from "node:path"; const home = process.env.OPENCLAW_HOME || process.env.HOME || "/home/user"; const stateDir = path.join(home, ".openclaw"); const configPath = path.join(stateDir, "openclaw.json"); fs.mkdirSync(stateDir, { recursive: true }); const config = { "env": { "OPENROUTER_API_KEY": process.env.OPENROUTER_API_KEY || "", "GEMINI_API_KEY": process.env.GEMINI_API_KEY || "" }, "gateway": { "mode": "local", "bind": "lan", "port": 7860, "auth": { "mode": "token", "token": process.env.OPENCLAW_GATEWAY_TOKEN || "mytoken123" }, "trustedProxies": ["10.20.0.0/16", "127.0.0.1", "10.16.0.0/16"], "controlUi": { "enabled": true, "allowInsecureAuth": true, "dangerouslyDisableDeviceAuth": true, "dangerouslyAllowHostHeaderOriginFallback": true } }, "channels": { "telegram": { "enabled": true, "botToken": process.env.TELEGRAM_BOT_TOKEN || "", "dmPolicy": "allowlist", "allowFrom": [process.env.TELEGRAM_ALLOW_FROM || "1034851560"] } }, "agents": { "defaults": { "model": { "primary": "google/gemini-2.5-flash" }, "models": { "google/gemini-2.5-flash": {}, "openrouter/openai/gpt-oss-120b:free": {}, "openrouter/qwen/qwen3-next-80b-a3b-instruct:free": {}, "openrouter/cognitivecomputations/dolphin-mistral-24b-venice-edition:free": {}, "openrouter/qwen/qwen3-coder:free": {} } } }, "skills": { "allowBundled": [], // ← همه ۵۳ Skills bundled eligible + قالب آماده در UI "entries": {} // ← اینجا بعداً می‌توانید skillهای خاص را override کنید } }; fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8"); console.log(`[OpenClaw HF Setup] Config with ALL Skills Templates + Gemini applied → ${configPath}`); EOF # Entrypoint: fix dirs/permissions + doctor --fix + gateway RUN printf '%s\n' \ '#!/bin/sh' \ 'set -e' \ 'if mkdir -p /data/.openclaw 2>/dev/null; then' \ ' export OPENCLAW_HOME=/data' \ 'else' \ ' export OPENCLAW_HOME=/home/user' \ ' mkdir -p /home/user/.openclaw' \ 'fi' \ 'node /app/spaces/huggingface/setup-hf-config.mjs' \ 'echo "[OpenClaw HF] Fixing permissions and directories..."' \ 'STATE_DIR="${OPENCLAW_HOME}/.openclaw"' \ 'mkdir -p "${STATE_DIR}/agents/main/sessions"' \ 'chmod 700 "${STATE_DIR}"' \ 'chmod 600 "${STATE_DIR}/openclaw.json" 2>/dev/null || true' \ 'echo "[OpenClaw HF] Running doctor --fix automatically..."' \ 'node /app/openclaw.mjs doctor --fix || echo "[Warning] Doctor had non-critical issues"' \ 'echo "[OpenClaw HF] All skills templates are now available in Control UI"' \ 'exec node /app/openclaw.mjs gateway --allow-unconfigured --bind lan --port 7860 "$@"' \ > /app/entrypoint.sh \ && chmod +x /app/entrypoint.sh RUN chown -R node:node /app \ && mkdir -p /home/user \ && chown -R node:node /home/user USER node ENTRYPOINT ["/app/entrypoint.sh"]