ccv / Dockerfile
EmilyReed96989's picture
Update Dockerfile
218c9fb verified
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"]