code2 / Dockerfile
gallyg's picture
Update Dockerfile
d5a09b5 verified
raw
history blame
883 Bytes
# 使用官方 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 /app
RUN chown -R user:user /app
# 切换为 user
USER user
ENV 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
# 创建数据存储和日志目录(防止权限报错)
RUN mkdir -p data logs
# Hugging Face Space 默认暴露并映射 7860 端口
EXPOSE 7860
# 启动 网页UI,指定 Host 为 0.0.0.0 并绑定至 7860 端口
CMD["python", "webui.py", "--host", "0.0.0.0", "--port", "7860"]