File size: 2,128 Bytes
89d226e 73ef895 89d226e 73ef895 89d226e a0f823c 89d226e 73ef895 89d226e 2af8a49 4ee7a5e f8294f1 73ef895 89d226e f8294f1 89d226e e793d5e 8d24432 f8294f1 d0a6395 8d24432 e8b6073 f1fb0ec d0a6395 219b572 3ccb816 d533556 3ccb816 c6f878c 3ccb816 d533556 f8294f1 d533556 acc7cea d533556 3ccb816 111a6f2 3ccb816 f1fb0ec 9f95f6c e793d5e 5631010 89d226e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | FROM node:22-slim
# Install system dependencies
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Install OpenClaw globally
RUN npm install -g openclaw@latest
# Create config directory
RUN mkdir -p /root/.openclaw
# Set up environment for Hugging Face Spaces
ENV PORT=7860
ENV OPENCLAW_GATEWAY_MODE=local
# Expose the port
EXPOSE 7860
# Create a startup script
RUN echo '#!/bin/bash\n\
set -x\n\
\n\
if [ -z "$GEMINI_API_KEY_1" ]; then\n\
echo "ERROR: GEMINI_API_KEY_1 is not set."\n\
exit 1\n\
fi\n\
\n\
mkdir -p /root/.openclaw/agents/main/agent\n\
mkdir -p /root/.openclaw/agents/main/sessions\n\
mkdir -p /root/.openclaw/credentials\n\
\n\
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json\n\
\n\
if [ ! -f /root/.openclaw/openclaw.json ]; then\n\
cat > /root/.openclaw/openclaw.json << EOF\n\
{\n\
"env": {\n\
"GOOGLE_API_KEY": "${GEMINI_API_KEY_1}",\n\
"GEMINI_API_KEY": "${GEMINI_API_KEY_1}",\n\
"GOOGLE_GENERATIVE_AI_API_KEY": "${GEMINI_API_KEY_1}",\n\
"PALM_API_KEY": "${GEMINI_API_KEY_1}"\n\
},\n\
"gateway": {\n\
"mode": "local",\n\
"bind": "lan",\n\
"port": 7860,\n\
"trustedProxies": [\n\
"10.16.4.123",\n\
"10.16.34.155",\n\
"10.20.1.9",\n\
"10.20.1.222",\n\
"10.20.26.157",\n\
"10.20.31.87"\n\
],\n\
"auth": {\n\
"mode": "token",\n\
"token": "hola"\n\
},\n\
"controlUi": {\n\
"enabled": true,\n\
"allowInsecureAuth": true,\n\
"dangerouslyDisableDeviceAuth": true,\n\
"allowedOrigins": ["*"],\n\
"dangerouslyAllowHostHeaderOriginFallback": true\n\
}\n\
},\n\
"agents": {\n\
"defaults": {\n\
"model": {\n\
"primary": "google/gemini-2.5-flash"\n\
}\n\
}\n\
}\n\
}\n\
EOF\n\
fi\n\
\n\
chmod 700 /root/.openclaw\n\
chmod 600 /root/.openclaw/openclaw.json\n\
\n\
openclaw doctor --fix\n\
\n\
echo "Starting OpenClaw gateway on port 7860..."\n\
exec openclaw gateway run --port 7860\n\
' > /usr/local/bin/start-openclaw && chmod +x /usr/local/bin/start-openclaw
CMD ["/usr/local/bin/start-openclaw"]
|