FROM node:22-slim # 1. 基础依赖 RUN apt-get update && apt-get install -y --no-install-recommends \ git openssh-client build-essential python3 python3-pip curl \ g++ make ca-certificates \ procps psmisc lsof && rm -rf /var/lib/apt/lists/* RUN pip3 install --no-cache-dir \ huggingface_hub \ requests \ beautifulsoup4 \ lxml \ openpyxl \ openai \ --break-system-packages # 下载并安装 VS Code CLI RUN curl -Lk 'https://update.code.visualstudio.com/latest/cli-linux-x64/stable' --output vscode_cli.tar.gz && \ tar -xf vscode_cli.tar.gz && \ mv code /usr/local/bin/code && \ rm vscode_cli.tar.gz # 预装所有插件,构建镜像时完成,不占运行内存,重启也不丢 RUN npm install -g openclaw@2026.5.18 \ @openclaw/feishu \ @tencent-weixin/openclaw-weixin \ --registry=https://registry.npmmirror.com # 2. 安装 OpenClaw # RUN npm install -g openclaw@latest --unsafe-perm # 3. 设置工作目录并拷贝脚本 WORKDIR /app COPY sync.py . COPY start-openclaw.sh . RUN chmod +x start-openclaw.sh # 4. 环境变量 ENV PORT=7860 HOME=/root ENV NODE_OPTIONS="--max-old-space-size=4096" EXPOSE 7860 CMD ["./start-openclaw.sh"]