File size: 10,069 Bytes
452ec8b
 
e1079e9
 
 
 
 
c273a20
e1079e9
452ec8b
9ba3e9c
00648f8
9ba3e9c
 
d8ae207
 
 
 
 
 
 
 
 
 
 
 
 
 
9ba3e9c
452ec8b
 
d3ce468
c85f354
 
 
4ce23a3
 
 
9066d9a
285b123
5ffe63d
cd724b5
 
 
 
aa31649
 
 
b7c2d68
c4cf781
616bb60
 
ccd8ba5
1ca666b
ccd8ba5
1ca666b
cd724b5
285b123
 
 
 
 
0bf39bb
0814409
452ec8b
f460d54
452ec8b
 
 
d8ae207
 
 
 
 
452ec8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86309b7
452ec8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ce23a3
 
 
452ec8b
c85f354
4a3a51e
 
 
 
8b00965
 
4a3a51e
 
8b00965
 
5ffe63d
 
 
 
 
 
 
452ec8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ff132bd
 
15ec657
 
 
 
452ec8b
 
 
15ec657
ff132bd
452ec8b
 
 
 
 
8b00965
452ec8b
 
 
 
 
5545054
5ffe63d
c42ba1f
452ec8b
 
86309b7
452ec8b
 
 
 
 
0b69753
 
 
5ff6405
d52df56
 
 
75305b7
e27bb91
2d085ef
fab6497
 
8880b62
fab6497
 
8880b62
fab6497
 
8880b62
 
285b123
99576c0
 
1ca666b
 
e2aff91
 
452ec8b
 
 
 
 
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
FROM node:22-slim

# Environment variables
ENV TZ=Asia/Shanghai
ENV OPENCLAW_PORT=18789
ENV OPENCLAW_GATEWAY_MODE=local
#ENV OPENCLAW_GATEWAY_PASSWORD=${OPENCLAW_GATEWAY_PASSWORD}
ENV CLAWPANEL_VER=5.2.15

# Install system dependencies
RUN apt-get update && \ 
  apt-get install -y git wget curl tzdata python3 && \
  rm -rf /var/lib/apt/lists/*
#   RUN apt-get install -y python3 \
#    libnss3 \
#    libatk1.0-0 \
#    libatk-bridge2.0-0 \
#    libcups2 \
#    libxkbcommon0 \
#    libxcomposite1 \
#    libxdamage1 \
#    libxfixes3 \
#    libxrandr2 \
#    libgbm1 \
#    libasound2 \
#    libpangocairo-1.0-0 \
#    libpango-1.0-0 \
#    libgtk-3-0 && \
#    rm -rf /var/lib/apt/lists/*

# Install OpenClaw globally
RUN npm install -g openclaw@2026.3.23-1 && \
    #npm install -g playwright && \
    #playwright install chromium && \
    #openclaw plugins install @wecom/wecom-openclaw-plugin@1.0.11 && \
    #openclaw plugins install @dingtalk-real-ai/dingtalk-connector && \
    #npm install -g @larksuiteoapi/feishu-openclaw-plugin && \
    #openclaw plugins install @larksuiteoapi/feishu-openclaw-plugin && \
    #openclaw plugins install @mjand66/openclaw-dingtalk
    npm install -g clawhub

# ClawPanel Pro
#RUN curl -fsSL https://gitee.com/zxy000006/ClawPanel/raw/main/scripts/install.sh -o install.sh && bash install.sh

# ClawPanel Lite
#RUN curl -fsSL https://gitee.com/zxy000006/ClawPanel/raw/main/scripts/install-lite.sh -o install-lite.sh && bash install-lite.sh

# clawpanel-
#RUN curl -fsSL https://raw.githubusercontent.com/qingchencloud/clawpanel/main/scripts/linux-deploy.sh | bash
#RUN git clone https://github.com/qingchencloud/clawpanel.git && cd clawpanel && npm install && npm run build
#RUN curl -fsSL https://github.com/zhaoxinyi02/ClawPanel/releases/download/pro-v${CLAWPANEL_VER}/clawpanel-v${CLAWPANEL_VER}-linux-amd64 -o clawpanel-v${CLAWPANEL_VER}-linux-amd64 && \
#chmod +x clawpanel-v${CLAWPANEL_VER}-linux-amd64
#CMD bash -c 'curl -L -o clawpanel-v${CLAWPANEL_VER} https://github.com/zhaoxinyi02/ClawPanel/releases/download/pro-v${CLAWPANEL_VER}/clawpanel-v${CLAWPANEL_VER}-linux-amd64 && chmod +x clawpanel-v${CLAWPANEL_VER}'
#RUN curl -L -o clawpanel-v${CLAWPANEL_VER} https://github.com/zhaoxinyi02/ClawPanel/releases/download/pro-v${CLAWPANEL_VER}/clawpanel-v${CLAWPANEL_VER}-linux-amd64 && chmod +x clawpanel-v${CLAWPANEL_VER}

RUN wget https://github.com/qingchencloud/clawpanel/releases/download/v0.9.8/ClawPanel_0.9.8_amd64.AppImage && chmod +x ClawPanel_0.9.8_amd64.AppImage

#RUN git clone https://github.com/qingchencloud/clawpanel.git && \
#    cd clawpanel && \
#    npm install && \
#    npm run build && \
#    sed -i "s/server: { *$/server: {\n    host: '0.0.0.0',\n    allowedHosts: true,/" vite.config.js
    #sed -i "s/server: { *\n *port: 1420,/server: {\n    host: '0.0.0.0',\n    allowedHosts: true,\n    port: 1420,/g" vite.config.js
#RUN curl -fsSL https://raw.githubusercontent.com/qingchencloud/clawpanel/main/scripts/linux-deploy.sh | bash
# 
#RUN npm install -g playwright && playwright install chromium

# 安装clawport
#RUN npm install -g clawport-ui
#RUN git clone https://github.com/crshdn/mission-control.git && \
#  cd mission-control && \
#  npm install && \
#  cp .env.example .env.local && \
#  sed -i 's/OPENCLAW_GATEWAY_TOKEN=.*/OPENCLAW_GATEWAY_TOKEN=hF.2002927..369/' .env.local

# 启动前禁用 device-pair
#RUN openclaw devices approve --all
#RUN openclaw plugins disable device-pair
#RUN openclaw approvals allowlist add *

# Create config directory
RUN mkdir -p /root/.openclaw

# Expose port
EXPOSE 18789


# Create startup script
RUN cat << 'EOF' > /usr/local/bin/start-openclaw
#!/bin/bash
set -e
set -x

# Check required environment variable
if [ -z "$GEMINI_APIKEY" ]; then
  echo "ERROR: GEMINI_APIKEY is not set. Exiting."
  exit 1
fi

# Create required directories
mkdir -p /root/.openclaw/agents/main/agent
mkdir -p /root/.openclaw/agents/main/sessions
mkdir -p /root/.openclaw/credentials

# Remove auth-profiles.json to force env usage
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json

# 强制重新生成配置
rm -f /root/.openclaw/openclaw.json

cat << 'INNEREOF' > /root/.openclaw/devices.json
{
  "trusted": ["*"]
}
INNEREOF

# Generate config if not exists
if [ ! -f /root/.openclaw/openclaw.json ]; then
cat << INNEREOF > /root/.openclaw/openclaw.json
{
  "env": {
    "GOOGLE_API_KEY": "${GEMINI_APIKEY}",
    "GEMINI_API_KEY": "${GEMINI_APIKEY}",
    "GOOGLE_GENERATIVE_AI_API_KEY": "${GEMINI_APIKEY}",
    "PALM_API_KEY": "${GEMINI_APIKEY}"
  },
  "gateway": {
    "mode": "${OPENCLAW_GATEWAY_MODE}",
    "bind": "lan",
    "port": ${OPENCLAW_PORT},
    "trustedProxies": ["0.0.0.0/0"],
    "auth": {
      "mode": "token",
      "token": "${OPENCLAW_GATEWAY_PASSWORD}"
    },
    "controlUi": {
      "allowInsecureAuth": true,
      "allowedOrigins": [
        "*"
      ]
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "custom-api-nvidia-kimi-k25": {
        "baseUrl": "${OPENAI_API_BASE}",
        "apiKey": "${OPENAI_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "${MODEL}",
            "name": "${MODEL} (Custom Provider)",
            "reasoning": false,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 256000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "custom-api-nvidia-kimi-k25/${MODEL}"
      },
      "models": {
        "custom-api-nvidia-kimi-k25/${MODEL}": {
          "alias": "custom-api-nvidia-kimi-k25"
        }
      },
    }
  }
}
INNEREOF
fi

# Fix permissions
chmod 700 /root/.openclaw
chmod 600 /root/.openclaw/openclaw.json || true
chmod 600 /root/.openclaw/agents/main/agent/auth-profiles.json 2>/dev/null || true

# Run doctor
openclaw doctor --fix || true

# 
openclaw config set gateway.http.endpoints.chatCompletions.enabled true

# 添加dingtalk
#openclaw plugins install @mjand66/openclaw-dingtalk
#openclaw config set channels.dingtalk.allowFrom '["*"]'
#openclaw config set channels.dingtalk.groupAllowFrom '["*"]'
#openclaw config set channels.dingtalk.dmPolicy "allowlist"
#openclaw config set channels.dingtalk.groupPolicy "allowlist"
#openclaw config set channels.dingtalk.clientId "dingmlwlgko0yyojfsqf"
#openclaw config set channels.dingtalk.clientSecret "mf5Tm_E6r__veTQkuCbN129_jyf991XRpIhG9quhp3UbhYq0Ql0ycImMyhjrMv5M"
#openclaw config set channels.dingtalk.robotCode "ding2agysywgqnjb79yi"
#openclaw config set channels.dingtalk.messageType "markdown"
#openclaw config set channels.dingtalk.cardMode true
#openclaw config set channels.dingtalk.enabled true

#openclaw plugins install @dingtalk-real-ai/dingtalk-connector
#openclaw config set channels.dingtalk-connector.clientId "dingmlwlgko0yyojfsqf"
#openclaw config set channels.dingtalk-connector.clientSecret "mf5Tm_E6r__veTQkuCbN129_jyf991XRpIhG9quhp3UbhYq0Ql0ycImMyhjrMv5M"
#openclaw config set channels.dingtalk-connector.gatewayToken "hF.2002927..369"
#openclaw config set channels.dingtalk-connector.asyncMode: true
#openclaw config set channels.dingtalk-connector.enabled true

# 添加wecom
#openclaw plugins install @wecom/wecom-openclaw-plugin@1.0.11
#openclaw config set channels.wecom.botId "${WECOM_AIBOT_ID}"
#openclaw config set channels.wecom.secret "${WECOM_AIBOT_SECRET}"
#openclaw config set channels.wecom.dmPolicy "allowlist"
#openclaw config set channels.wecom.allowFrom '["*"]'
#openclaw config set channels.wecom.enabled true

# 添加discord
#openclaw config set channels.discord.token "${DISCORD_AIBOT_SECRET}"
#openclaw config set channels.discord.groupPolicy "open"
#openclaw config set channels.discord.streaming "off"
#openclaw config set channels.discord.enabled true

# 添加feishu
#openclaw plugins install @larksuiteoapi/feishu-openclaw-plugin
#已集成,可以不用安装
#openclaw config set channels.feishu.domain "feishu"
#openclaw config set channels.feishu.appId "cli_a9393c2f71385cd5"
#openclaw config set channels.feishu.appSecret "TdjZvW9vjd947oSpWJb0mgJwjLdtb3Eh"
#openclaw config set channels.feishu.connectionMode "websocket"
#openclaw config set channels.feishu.groupPolicy "allowlist"
#openclaw config set channels.feishu.allowFrom '["*"]'
#openclaw config set channels.feishu.groupAllowFrom '["*"]'
#openclaw config set channels.feishu.enabled true



# 自动批准
#openclaw devices approve --all || true

echo "Starting ClawPanel/OpenClaw gateway on port ${OPENCLAW_PORT}..."

#openclaw approvals allowlist add *

#openclaw doctor --fix

#exec openclaw gateway run --port ${OPENCLAW_PORT}

#exec openclaw start --port ${OPENCLAW_PORT}
#exec openclaw agent run --name main
#clawport dev --port 3000 &
#openclaw gateway run --port ${OPENCLAW_PORT} &
#openclaw devices list &
#sleep 30  # 确保 gateway 已启动
#openclaw devices approve --all || true
#openclaw dashboard --no-open &
#clawport dev --port 3000 &
#cd /app 
#npm run serve &
#wait -n
#cd mission-control && npm run dev &
#openclaw gateway run --port ${OPENCLAW_PORT} &
#cd clawpanel & npm run dev &
#wait -n

#openclaw gateway run --port ${OPENCLAW_PORT} & 
#cd clawpanel && npm run preview -- --host 0.0.0.0 --port 1420 &
#cd .. && openclaw gateway run --port ${OPENCLAW_PORT} &
# 1️⃣ 启动 OpenClaw gateway
#openclaw gateway run --port ${OPENCLAW_PORT} &

# 2️⃣ 等几秒让 gateway 初始化
#sleep 30

# 3️⃣ 启动 clawpanel
#cd clawpanel && npm run preview -- --host 0.0.0.0 --port 1420 &
#wait -n
#cd clawpanel && npm run preview -- --host 0.0.0.0 --port 1420
#openclaw gateway run --port ${OPENCLAW_PORT} &
#/opt/clawpanel/clawpanel &
#./clawpanel-v${CLAWPANEL_VER} &
./ClawPanel_0.9.8_amd64.AppImage &
openclaw gateway run --port ${OPENCLAW_PORT} &
wait -n
EOF

RUN chmod +x /usr/local/bin/start-openclaw

CMD ["/usr/local/bin/start-openclaw"]