Simford.Dong
refactor: move sync and startup logic to separate files to fix Docker build errors
7eb2e6e | # 核心镜像:Node 22 slim 保证了环境的现代性与轻量化 | |
| FROM node:22-slim | |
| # 1. 安装系统依赖 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git openssh-client build-essential python3 python3-pip \ | |
| g++ make ca-certificates curl chromium tzdata \ | |
| libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \ | |
| libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 \ | |
| libgbm1 libasound2 libpangocairo-1.0-0 libpango-1.0-0 \ | |
| && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | |
| && echo "Asia/Shanghai" > /etc/timezone \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 2. 安装 Hugging Face 命令行工具 | |
| RUN pip3 install --no-cache-dir huggingface_hub --break-system-packages | |
| # 3. 构建环境优化 | |
| RUN update-ca-certificates && \ | |
| git config --global http.sslVerify false && \ | |
| git config --global url."https://github.com/".insteadOf ssh://git@github.com/ | |
| # 4. 全局安装 OpenClaw | |
| ENV HOME=/root | |
| RUN npm install -g openclaw@latest zod --unsafe-perm | |
| # 4.1 安装 Feishu 插件依赖 | |
| RUN cd /usr/local/lib/node_modules/openclaw && npm install @larksuiteoapi/node-sdk --unsafe-perm | |
| # 5. 设置环境变量 | |
| ENV PORT=7860 \ | |
| OPENCLAW_GATEWAY_MODE=local \ | |
| OPENCLAW_BROWSER_PATH=/usr/bin/chromium | |
| # 6. 核心同步引擎 (sync.py) | |
| COPY sync.py /usr/local/bin/sync.py | |
| # 7. 容器入口脚本 (start-openclaw.sh) | |
| COPY start-openclaw.sh /usr/local/bin/start-openclaw | |
| RUN chmod +x /usr/local/bin/start-openclaw | |
| EXPOSE 7860 | |
| CMD ["/usr/local/bin/start-openclaw"] | |