leonsimon23 commited on
Commit
6cd46ec
·
verified ·
1 Parent(s): db306ee

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -9
Dockerfile CHANGED
@@ -8,20 +8,17 @@ WORKDIR /app
8
  RUN apt-get update && apt-get install -y --no-install-recommends git
9
 
10
  # --- 关键步骤:使用PAT克隆私有仓库 ---
11
- # 1. 从Hugging Face Secrets中获取GitHub用户名和PAT
12
- # 这两个Secrets将在Hugging Face界面上设置
13
- # --mount=type=secret... 允许我们在构建时安全地访问这些Secrets
14
- # 我们将用户名和PAT写入临时文件
15
  RUN --mount=type=secret,id=GH_USERNAME \
16
  --mount=type=secret,id=GH_TOKEN \
17
- git clone https://$(cat /run/secrets/GH_USERNAME):$(cat /run/secrets/GH_TOKEN)@github.com/GH_USERNAME/ducg_web_app.git .
18
 
19
  # --- 设置Python环境 ---
20
- # 1. 安装Python依赖
21
- # 这里的 requirements.txt 已经在git clone后存在于工作目录中
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
- # 2. 安装Gunicorn用于生产环境
25
  RUN pip install gunicorn
26
 
27
  # --- 运行应用 ---
@@ -29,4 +26,4 @@ RUN pip install gunicorn
29
  EXPOSE 7860
30
 
31
  # 启动应用的命令
32
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
 
8
  RUN apt-get update && apt-get install -y --no-install-recommends git
9
 
10
  # --- 关键步骤:使用PAT克隆私有仓库 ---
11
+ # 从Hugging Face Secrets中获取GitHub用户名和PAT
12
+ # 注意:URL路径中的 'leoncool23' 是硬编码的,必须是您的真实用户名
 
 
13
  RUN --mount=type=secret,id=GH_USERNAME \
14
  --mount=type=secret,id=GH_TOKEN \
15
+ git clone https://$(cat /run/secrets/GH_USERNAME):$(cat /run/secrets/GH_TOKEN)@github.com/leoncool23/ducg_web_app.git .
16
 
17
  # --- 设置Python环境 ---
18
+ # 安装Python依赖
 
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # 安装Gunicorn用于生产环境
22
  RUN pip install gunicorn
23
 
24
  # --- 运行应用 ---
 
26
  EXPOSE 7860
27
 
28
  # 启动应用的命令
29
+ CMD ["gunicorn", "--bind", "0. 0.0.0:7860", "app:app"]