jacky3102 commited on
Commit
6f95f1d
·
verified ·
1 Parent(s): ceee45c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -10
Dockerfile CHANGED
@@ -2,23 +2,23 @@ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
- # 安装ffmpeg
6
- RUN apt-get update && apt-get install -y ffmpeg && \
7
- apt-get clean && \
8
- rm -rf /var/lib/apt/lists/*
 
 
9
 
10
  # 复制依赖文件
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
 
 
 
14
  # 复制应用代码
15
  COPY app.py .
16
 
17
- # 创建模型缓存目录
18
- RUN mkdir -p /root/.cache/whisper
19
-
20
- # 暴露端口
21
  EXPOSE 7860
22
 
23
- # 启动应用
24
- CMD ["python", "app.py"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # 只安装必要的ffmpeg组件,减少依赖
6
+ RUN apt-get update && \
7
+ apt-get install -y --no-install-recommends \
8
+ ffmpeg \
9
+ && apt-get clean \
10
+ && rm -rf /var/lib/apt/lists/*
11
 
12
  # 复制依赖文件
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # 预下载whisper模型(可选,加快首次启动)
17
+ # RUN python -c "import whisper; whisper.load_model('base')"
18
+
19
  # 复制应用代码
20
  COPY app.py .
21
 
 
 
 
 
22
  EXPOSE 7860
23
 
24
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]