Spaces:
Running
Running
File size: 4,252 Bytes
85f33f3 645618b cb292ea 218c9fb cb292ea 85f33f3 645618b 85f33f3 3bb203b a98e136 9930d8c 645618b 05d716c 645618b 789f590 05d716c 645618b 789f590 645618b 05d716c 85f33f3 a480d7e 645618b 0f1d119 85f33f3 0f1d119 645618b 0f1d119 645618b 0f1d119 645618b 0f1d119 645618b 0f1d119 645618b 0f1d119 85f33f3 0f1d119 218c9fb 645618b 218c9fb 645618b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | FROM ghcr.io/openclaw/openclaw:latest
# Force rebuild - update this timestamp to invalidate cache
ARG REBUILD_DATE=2026-03-24-v3
USER root
# 强制北京时间(解决 HF Spaces 默认 UTC 导致 agent 汇报时间错误)
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app
# Install openclaw-china channels plugin
RUN node openclaw.mjs plugins install @openclaw-china/channels || \
(echo "❌ Failed to install @openclaw-china/channels plugin" && exit 1)
# Install wecom-app-ops skill (optional but recommended for wecom-app operations)
RUN mkdir -p /root/.openclaw/skills && \
if [ -d "/root/.openclaw/extensions/openclaw-china/extensions/wecom-app/skills/wecom-app-ops" ]; then \
cp -a /root/.openclaw/extensions/openclaw-china/extensions/wecom-app/skills/wecom-app-ops /root/.openclaw/skills/ && \
echo "✅ wecom-app-ops skill installed"; \
else \
echo "⚠️ wecom-app-ops skill not found, skipping"; \
fi
# Install Chromium and dependencies for agent-browser
RUN apt-get update && \
apt-get install -y --no-install-recommends chromium \
libxcb-shm0 libx11-xcb1 libx11-6 libxcb1 libxext6 libxrandr2 \
libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libgtk-3-0 \
libpangocairo-1.0-0 libpango-1.0-0 libatk1.0-0 libcairo-gobject2 \
libcairo2 libgdk-pixbuf-2.0-0 libxrender1 libasound2 libfreetype6 \
libfontconfig1 libdbus-1-3 libnss3 libnspr4 libatk-bridge2.0-0 \
libdrm2 libxkbcommon0 libatspi2.0-0 libcups2 libxshmfence1 libgbm1 && \
rm -rf /var/lib/apt/lists/*
# Install agent-browser and Playwright
RUN npm install -g agent-browser@latest playwright
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
# Install agent-browser skill from ClawHub
RUN npx -y clawhub@latest install agent-browser --force || echo "agent-browser skill install attempted"
# Install ClawMate Companion plugin via manual git clone
RUN echo "📦 Installing ClawMate Companion..." && \
git clone --depth 1 https://github.com/BytePioneer-AI/clawmate.git /tmp/clawmate && \
mkdir -p /root/.openclaw/extensions && \
cp -r /tmp/clawmate/packages/clawmate-companion /root/.openclaw/extensions/clawmate-companion && \
cd /root/.openclaw/extensions/clawmate-companion && \
npm install --omit=dev --no-audit --no-fund && \
rm -rf /tmp/clawmate && \
echo "✅ ClawMate Companion 安装成功"
# ============================================================
# 敏感文件不再 COPY 进镜像,改为运行时从 GitHub 仓库克隆
# 以下只预创建目录结构,文件由 entrypoint.sh 从 GitHub 复制填充
# ============================================================
# patches 目标目录(clawmate 补丁)
RUN mkdir -p /root/.openclaw/extensions/clawmate-companion/src/core \
&& mkdir -p /root/.openclaw/extensions/clawmate-companion/skills/clawmate-companion
# characters 目标目录(Maggie 角色资源)
RUN mkdir -p /root/.openclaw/extensions/clawmate-companion/skills/clawmate-companion/assets/characters/maggie/images
# workspace 目标目录(角色设定、任务文档等)
RUN mkdir -p /root/.openclaw/workspace/memory
# cron 目标目录
RUN mkdir -p /root/.openclaw/cron
# config 目标目录
RUN mkdir -p /root/.openclaw
# Install git for cloning deploy files
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*
# Make openclaw CLI available globally (agent exec tool needs it for `openclaw status` etc.)
# Use symlink instead of wrapper script to avoid Node.js module resolution issues
RUN ln -sf /app/openclaw.mjs /usr/local/bin/openclaw && chmod +x /app/openclaw.mjs
# Copy and set entrypoint script
COPY entrypoint.sh /app/entrypoint.sh
# Fix line endings and set executable permission
RUN sed -i 's/\r$//' /app/entrypoint.sh && chmod +x /app/entrypoint.sh
# HF Spaces requires port 7860
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:7860/ || exit 1
# Use entrypoint to inject secrets at runtime
CMD ["/app/entrypoint.sh"]
|