123 / Dockerfile
1guow's picture
Update Dockerfile
fd950e4 verified
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
# 更新系统并安装必要工具
RUN apt-get update && apt-get install -y \
curl wget gnupg ca-certificates lsb-release \
python3 python3-pip git openssh-client vim net-tools dnsutils cron \
&& rm -rf /var/lib/apt/lists/*
# 安装 Node.js 22
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs
# 安装 Python 依赖
RUN pip3 install --break-system-packages huggingface_hub
# 全局安装 openclaw
RUN npm install -g openclaw@latest
# --- 创建极简启动脚本 (start-openclaw.sh) ---
# 关键改动:完全不留任何配置文件,启动后通过 Web 界面配置一切
RUN echo '#!/bin/bash\n\
echo "Cleaning old configurations..."\n\
# 彻底删除所有可能冲突的旧文件,包括 agent 认证和模型缓存\n\
rm -rf /root/.openclaw/agents\n\
mkdir -p /root/.openclaw\n\
\n\
echo "Starting OpenClaw gateway..."\n\
# 以未配置模式直接启动,不生成任何配置文件\n\
openclaw gateway --port 7860 --allow-unconfigured &\n\
CLAW_PID=$!\n\
\n\
echo "OpenClaw is running on port 7860!"\n\
wait $CLAW_PID' > /root/start-openclaw.sh && chmod +x /root/start-openclaw.sh
# 暴露端口
EXPOSE 7860
# 启动服务
CMD ["/root/start-openclaw.sh"]