jinv2 commited on
Commit
997eef4
·
verified ·
1 Parent(s): 91242ca

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -9
Dockerfile CHANGED
@@ -1,21 +1,22 @@
 
1
  FROM python:3.9-slim
2
 
3
- # 1. 物理环境准备 (FFmpeg & Python3)
4
- RUN apt-get update && apt-get install -y ffmpeg python3-pip && rm -rf /var/lib/apt/lists/*
5
 
6
- # 2. 设置权限与用户
7
  RUN useradd -m -u 1000 user
8
  USER user
9
  ENV PATH="/home/user/.local/bin:\$PATH"
10
  WORKDIR /app
11
 
12
- # 3. 注入依赖 (使用 python3 明确指向)
13
  COPY --chown=user requirements.txt .
14
- RUN python3 -m pip install --no-cache-dir --upgrade pip && \
15
- python3 -m pip install --no-cache-dir --upgrade -r requirements.txt
16
 
17
- # 4. 拷贝全量逻辑
18
  COPY --chown=user . .
19
 
20
- # 5. 启动神思演播室
21
- CMD ["python3", "app.py"]
 
1
+ # 1. 使用官方镜像,它自带了 Python 和 Pip
2
  FROM python:3.9-slim
3
 
4
+ # 2. 仅安装音频必须的 FFmpeg,不再安装冗余的 python3-pip
5
+ RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
6
 
7
+ # 3. 设置权限与用户
8
  RUN useradd -m -u 1000 user
9
  USER user
10
  ENV PATH="/home/user/.local/bin:\$PATH"
11
  WORKDIR /app
12
 
13
+ # 4. 使用绝对路径调用 Python 模块,彻底解决 "not found"
14
  COPY --chown=user requirements.txt .
15
+ RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade pip && \
16
+ /usr/local/bin/python -m pip install --no-cache-dir --upgrade -r requirements.txt
17
 
18
+ # 5. 拷贝全量逻辑
19
  COPY --chown=user . .
20
 
21
+ # 6. 启动演播室
22
+ CMD ["/usr/local/bin/python", "app.py"]