Spaces:
Running
Running
File size: 2,386 Bytes
3d325be 995f45c 0fc3070 3d325be 0fc3070 3d325be 0fc3070 3d325be 0fc3070 3d325be 0fc3070 3d325be 716a951 3d325be 0fc3070 cae0414 0fc3070 3d325be 995f45c 3d325be 995f45c 3d325be 995f45c 3d325be 995f45c 3d325be 995f45c 365bffd 3d325be 995f45c 3d325be 995f45c 3d325be | 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 | # G1: OpenClaw HF Deployment - Dockerfile
# 总目标: HF部署OpenClaw + CC-Switch-Web,持久化、多Agent、飞书/微信
# 所有程序安装固化在镜像中,重启无需重新安装
FROM node:22-slim
LABEL maintainer="OpenClaw HF Deploy"
LABEL version="2.1.0"
LABEL description="OpenClaw AI Gateway + CC-Switch-Web, WebDAV/HF backup, Feishu/WeChat integration"
# G1.1: 系统依赖(固化安装)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
openssh-client \
python3 \
python3-pip \
python3-venv \
curl \
ca-certificates \
tar \
gzip \
jq \
vim \
wget \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# G1.2: Python包(固化安装)
RUN pip3 install --no-cache-dir --break-system-packages \
huggingface_hub \
requests \
schedule
# G1.3: 安装 OpenClaw(固化安装)
RUN npm config set registry https://registry.npmmirror.com && \
npm install -g openclaw@latest --unsafe-perm --no-audit --no-fund && \
npx -y @tencent-weixin/openclaw-weixin-cli@latest install && \
npm config delete registry
# 验证 OpenClaw 安装
RUN openclaw --version || echo "[WARN] openclaw version check failed"
# 创建工作目录
WORKDIR /app
# G1.4: 复制应用文件
COPY backup-manager.py .
COPY config-generator.py .
COPY sync.py .
COPY start-openclaw.sh .
COPY router.js .
COPY scripts/ ./scripts/
# G1.5: 下载 CC-Switch-Web 预编译二进制 (正式版)
RUN mkdir -p /opt/cc-switch-web && \
curl -fL https://github.com/Laliet/cc-switch-web/releases/download/v0.11.1/cc-switch-server-linux-x86_64 \
-o /opt/cc-switch-web/server && \
chmod +x /opt/cc-switch-web/server
# 设置执行权限
RUN chmod +x start-openclaw.sh scripts/*.sh
# 创建持久化目录
RUN mkdir -p /root/.openclaw/{agents,workspace,credentials,sessions,backups,skills,logs} \
&& mkdir -p /root/.cc-switch
# 环境变量默认值
ENV PORT=18888 \
OPENCLAW_GATEWAY_PORT=18889 \
OPENCLAW_STATE_DIR=/root/.openclaw \
HOME=/root \
NODE_OPTIONS=--max-old-space-size=512 \
NPM_CONFIG_REGISTRY=https://registry.npmmirror.com \
NODE_ENV=production \
CCSWITCH_PORT=3000 \
CCSWITCH_HOST=127.0.0.1 \
CCSWITCH_USERNAME=admin \
CCSWITCH_PASSWORD=""
# 暴露端口 (Router on 18888)
EXPOSE 18888
# 启动命令
CMD ["./start-openclaw.sh"]
|