File size: 1,139 Bytes
5cc927f a37537e 1b20dcc 5cc927f 1b20dcc 5cc927f 1b20dcc 5cc927f 0a21338 1b20dcc 0a21338 1b20dcc 5cc927f 1b20dcc | 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 | # 使用 OpenClaw 汉化版镜像作为基础
# 镜像地址:qingchencloud/openclaw-zh (来自 Docker Hub)
FROM ghcr.io/1186258278/openclaw-zh:latest
# 1. 安装系统依赖和 Python(用于数据同步脚本)
# 汉化版镜像基于 Node.js 环境,可能缺少 python,因此仍需安装
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
openssh-client \
build-essential \
python3 \
python3-pip \
g++ \
make \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# 安装 Python 的 huggingface_hub 库,用于与 Hugging Face Dataset 交互实现数据持久化
RUN pip3 install --no-cache-dir huggingface_hub --break-system-packages
# 2. 设置工作目录,并将数据同步脚本和启动脚本复制到镜像中
WORKDIR /app
COPY sync.py .
COPY start-openclaw.sh .
RUN chmod +x start-openclaw.sh
# 3. 设置 Hugging Face Spaces 默认端口和环境变量
ENV PORT=7862
ENV HOME=/root
EXPOSE 7862
# 4. 容器启动时执行自定义启动脚本(该脚本会处理配置生成、数据恢复、定时备份并启动 OpenClaw)
CMD ["./start-openclaw.sh"] |