gallyg commited on
Commit
e76f9c3
·
verified ·
1 Parent(s): b2e8697

Update Dockerfile

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