zwq2018 commited on
Commit
f8fabb7
1 Parent(s): cfd391a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -18
Dockerfile CHANGED
@@ -1,29 +1,17 @@
1
  # 使用Hugging Face提供的基础镜像
2
  FROM python:3.9
3
 
 
4
 
5
- RUN useradd -m appuser
6
- WORKDIR /home/appuser
7
 
8
- # 更改工作目录的所有权,以便新用户可以在其中写入
9
- RUN chown appuser:appuser /home/appuser
10
 
11
- # 切换到新用户
12
- USER appuser
13
 
14
- # 安装Python依赖
15
- COPY --chown=appuser:appuser requirements.txt /home/appuser/
16
- RUN pip install --no-cache-dir -r requirements.txt
17
-
18
- # 拷贝项目文件到工作目录
19
- COPY --chown=appuser:appuser . /home/appuser/
20
-
21
- # 公开 Hugging Face Spaces 需要的 8000 端口
22
- EXPOSE 8000
23
-
24
- # 运行启动脚本 (确保你有一个app.py文件)
25
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
26
 
 
27
 
28
 
29
 
 
1
  # 使用Hugging Face提供的基础镜像
2
  FROM python:3.9
3
 
4
+ WORKDIR /code
5
 
6
+ COPY ./requirements.txt /code/requirements.txt
7
+ COPY ./ /code/.
8
 
 
 
9
 
10
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
11
 
12
+ COPY . .
 
 
 
 
 
 
 
 
 
 
 
13
 
14
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
15
 
16
 
17