File size: 1,624 Bytes
9bfb0ec
6b0195c
9bfb0ec
 
 
0efe61a
e18e445
9bfb0ec
 
 
 
6b0195c
3624475
 
e12a5a2
 
 
 
8720004
 
 
 
 
4b33a31
e12a5a2
 
 
4b33a31
8720004
 
e12a5a2
8720004
e12a5a2
 
 
8720004
08f6c3b
e12a5a2
 
 
 
 
8720004
9bf95d2
e12a5a2
 
 
 
 
 
 
 
 
9bfb0ec
 
3624475
 
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
FROM node:22-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    git openssh-client build-essential python3 ca-certificates \
    && rm -rf /var/lib/apt/lists/*

RUN npm install -g openclaw@latest --force --unsafe-perm

ENV PORT=7860 \
    OPENCLAW_GATEWAY_MODE=local \
    HOME=/root

RUN mkdir -p /root/.openclaw/sessions

RUN cat > /usr/local/bin/setup.sh << 'SETUPSCRIPT'
#!/bin/bash
set -e

BASE_URL="${OPENCLAW_BASE_URL:-https://api.openrouter.ai/v1}"
API_KEY="${OPENCLAW_API_KEY:-}"
MODEL="${OPENCLAW_MODEL:-anthropic/claude-3-haiku}"
PASSWORD="${OPENCLAW_GATEWAY_PASSWORD:-openclaw123}"

cat > /root/.openclaw/openclaw.json << EOF
{
  "models": {
    "providers": {
      "custom": {
        "baseUrl": "${BASE_URL}",
        "apiKey": "${API_KEY}",
        "api": "openai-completions",
        "models": [{"id": "${MODEL}", "name": "Custom Model", "contextWindow": 128000}]
      }
    }
  },
  "agents": {"defaults": {"model": {"primary": "custom/${MODEL}"}}},
  "channels": {"telegram": {"botToken": "", "enabled": false}},
  "gateway": {
    "mode": "local",
    "bind": "lan",
    "port": 7860,
    "trustedProxies": ["0.0.0.0/0", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
    "auth": {"mode": "token", "token": "${PASSWORD}"},
    "controlUi": {"allowInsecureAuth": true, "dangerouslyAllowHostHeaderOriginFallback": true, "dangerouslyDisableDeviceAuth": true}
  }
}
EOF

echo "Config created"
cat /root/.openclaw/openclaw.json
SETUPSCRIPT

RUN chmod +x /usr/local/bin/setup.sh && /usr/local/bin/setup.sh

EXPOSE 7860

CMD ["sh", "-c", "exec openclaw gateway run --port $PORT"]