dev / Dockerfile
joeshen's picture
Update Dockerfile
1ca666b verified
Raw History Blame Contribute Delete
10.1 kB
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"]