ljx77qaq commited on
Commit
fc7f22e
·
verified ·
1 Parent(s): e355246

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -8
Dockerfile CHANGED
@@ -1,18 +1,16 @@
1
- # 使用官方的 Python 3.10 镜像作为基础环境
2
- FROM python:3.10
3
 
4
- # 设置工作目录
5
  WORKDIR /app
6
 
7
- # 复制 requirements.txt 并安装依赖
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # 当前目录下的所有文件 (包括 app.py) 复制到容器的 /app 目录下
12
  COPY . .
13
 
14
- # 暴露抱脸要求的 7860 端口
15
  EXPOSE 7860
16
 
17
- # 告诉系统启动时运行哪条命令(注意 CMD 后面有空格)
18
- CMD ["python", "-u", "app.py"]
 
1
+ FROM python:3.11-slim
 
2
 
 
3
  WORKDIR /app
4
 
5
+ # 复制依赖文件并安装
6
  COPY requirements.txt .
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
9
+ # 复制当前目录下的所有代码到容器
10
  COPY . .
11
 
12
+ # 暴露 HF 要求的 7860 端口
13
  EXPOSE 7860
14
 
15
+ # 使用 uvicorn 启动 FastAPI
16
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]