Update Dockerfile
Browse files- Dockerfile +13 -9
Dockerfile
CHANGED
@@ -1,15 +1,17 @@
|
|
1 |
-
#
|
2 |
FROM pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime
|
3 |
|
|
|
4 |
ENV PYTHONUNBUFFERED=1 \
|
5 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
6 |
PIP_PREFER_BINARY=1 \
|
7 |
NUMBA_CACHE_DIR=/tmp/numba_cache
|
8 |
# NUMBA_DISABLE_JIT=1 # ← 若仍报 numba JIT 缓存错误,可取消注释完全禁用 JIT(更稳,稍慢)
|
9 |
|
|
|
10 |
WORKDIR /app
|
11 |
|
12 |
-
#
|
13 |
RUN apt-get update && \
|
14 |
apt-get install -y --no-install-recommends \
|
15 |
ffmpeg libsox-dev git \
|
@@ -17,24 +19,26 @@ RUN apt-get update && \
|
|
17 |
rm -rf /var/lib/apt/lists/* && \
|
18 |
mkdir -p /tmp/numba_cache && chmod -R 777 /tmp/numba_cache
|
19 |
|
20 |
-
#
|
21 |
RUN git clone --depth 1 https://github.com/RVC-Boss/GPT-SoVITS.git /app
|
22 |
|
23 |
-
# Python
|
24 |
RUN pip install --upgrade pip && \
|
25 |
pip install --no-cache-dir -r /app/requirements.txt && \
|
26 |
-
#
|
27 |
-
pip install --no-cache-dir --force-reinstall --no-deps librosa==0.9.2 numba==0.56.4 && \
|
28 |
pip install --no-cache-dir fastapi uvicorn soundfile huggingface_hub ffmpeg-python
|
29 |
|
30 |
-
#
|
31 |
COPY download_support_models.py /app/download_support_models.py
|
32 |
RUN python /app/download_support_models.py || true
|
33 |
|
34 |
-
#
|
35 |
COPY weights/ /app/pretrained_models/shantianliang/
|
36 |
COPY reference_audio/ /app/reference_audio/
|
37 |
|
|
|
38 |
EXPOSE 7860
|
39 |
|
40 |
-
|
|
|
|
1 |
+
# 使用官方 PyTorch 镜像作为基础
|
2 |
FROM pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime
|
3 |
|
4 |
+
# 设置环境变量,优化 Python 和 Pip 的行为
|
5 |
ENV PYTHONUNBUFFERED=1 \
|
6 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
7 |
PIP_PREFER_BINARY=1 \
|
8 |
NUMBA_CACHE_DIR=/tmp/numba_cache
|
9 |
# NUMBA_DISABLE_JIT=1 # ← 若仍报 numba JIT 缓存错误,可取消注释完全禁用 JIT(更稳,稍慢)
|
10 |
|
11 |
+
# 设置工作目录
|
12 |
WORKDIR /app
|
13 |
|
14 |
+
# 安装系统依赖和构建工具链
|
15 |
RUN apt-get update && \
|
16 |
apt-get install -y --no-install-recommends \
|
17 |
ffmpeg libsox-dev git \
|
|
|
19 |
rm -rf /var/lib/apt/lists/* && \
|
20 |
mkdir -p /tmp/numba_cache && chmod -R 777 /tmp/numba_cache
|
21 |
|
22 |
+
# 克隆 GPT-SoVITS 仓库
|
23 |
RUN git clone --depth 1 https://github.com/RVC-Boss/GPT-SoVITS.git /app
|
24 |
|
25 |
+
# 安装 Python 依赖
|
26 |
RUN pip install --upgrade pip && \
|
27 |
pip install --no-cache-dir -r /app/requirements.txt && \
|
28 |
+
# [关键修改] 为防止版本冲突,这里强制重装 numpy, librosa, 和 numba 到兼容版本
|
29 |
+
pip install --no-cache-dir --force-reinstall --no-deps numpy==1.23.5 librosa==0.9.2 numba==0.56.4 && \
|
30 |
pip install --no-cache-dir fastapi uvicorn soundfile huggingface_hub ffmpeg-python
|
31 |
|
32 |
+
# 预下载依赖模型
|
33 |
COPY download_support_models.py /app/download_support_models.py
|
34 |
RUN python /app/download_support_models.py || true
|
35 |
|
36 |
+
# 复制您自己的权重文件和参考音频
|
37 |
COPY weights/ /app/pretrained_models/shantianliang/
|
38 |
COPY reference_audio/ /app/reference_audio/
|
39 |
|
40 |
+
# 暴露 API 端口
|
41 |
EXPOSE 7860
|
42 |
|
43 |
+
# 容器启动命令
|
44 |
+
CMD ["python", "api_v2.py", "-a", "0.0.0.0", "-p", "7860", "-c", "GPT_SoVITS/configs/tts_infer.yaml"]
|