FROM node:22-slim # ─── 1. 系统基础依赖 ───────────────────────────────────────────────────────── RUN apt-get update && apt-get install -y --no-install-recommends \ git build-essential python3 python3-pip make g++ curl wget ca-certificates \ openssh-client procps dumb-init jq unzip zip locales xvfb cron sqlite3 \ chromium libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 \ libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \ libxrandr2 libgbm1 libasound2 libpango-1.0-0 libcairo2 \ libx11-xcb1 libxcb-dri3-0 libatspi2.0-0 libwayland-client0 \ fonts-liberation fonts-noto-cjk \ && locale-gen zh_CN.UTF-8 \ && rm -rf /var/lib/apt/lists/* RUN pip3 install --no-cache-dir huggingface_hub --break-system-packages # ─── 2. 环境变量 ───────────────────────────────────────────────────────────── ENV LANG=zh_CN.UTF-8 \ LANGUAGE=zh_CN:zh \ LC_ALL=zh_CN.UTF-8 \ HOME=/root \ NPM_CONFIG_REGISTRY=https://registry.npmmirror.com \ PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright \ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \ CHROME_BIN=/usr/bin/chromium WORKDIR /app # ─── 3. 复制并转换换行符 ────────────────────────────────────────────────────── COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY backup.sh /usr/local/bin/backup.sh RUN sed -i 's/\r$//' /usr/local/bin/entrypoint.sh && \ sed -i 's/\r$//' /usr/local/bin/backup.sh && \ chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/backup.sh # ─── 4. 全局安装并预设目录 ─────────────────────────────────────────────────── RUN npm install -g openclaw@latest RUN mkdir -p /root/.openclaw RUN openclaw doctor --fix || true # 每小时备份一次 RUN echo "0 * * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1" | crontab - EXPOSE 7860 ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/usr/local/bin/entrypoint.sh"]