Update Dockerfile
Browse files1124347591067814910111812132122141516241718192720212223242530312627# 使用官方 Python 轻量级镜像FROM python:3.11-slim
# 安装 Git 及必要工具RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
# Hugging Face 强制要求使用非 root 用户运行 (UID 1000)RUN useradd -m -u 1000 user
# 设置工作目录,并赋予权限WORKDIR /appRUN chown -R user:user /app
# 切换为 userUSER userENV PATH="/home/user/.local/bin:$PATH"
# 克隆项目代码 (确保拉取最新版)RUN git clone https://github.com/cnlimiter/codex-register.git .
# 安装项目依赖RUN pip install --no-cache-dir -r requirements.txt# 安装依赖 + huggingface_hubRUN pip install --no-cache-dir -r requirements.txt huggingface_hub
# 创建数据存储和日志目录(防止权限报错)# 创建目录RUN mkdir -p data logs
# Hugging Face Space 默认暴露并映射 7860 端口# 复制刚才写的同步脚本到镜像里# (如果你是直接在 HF 页面创建文件的,此步可以忽略,只要文件在根目录即可)# COPY --chown=user:user sync_run.py .
EXPOSE 7860
# 启动 网页UI,指定 Host 为 0.0.0.0 并绑定至 7860 端口(注意 CMD 后的空格)CMD ["python", "webui.py", "--host", "0.0.0.0", "--port", "7860"]# 启动改为运行同步脚本CMD ["python", "sync_run.py"]Dockerfile+9-13