Spaces:
Build error
Build error
File size: 983 Bytes
7320408 1f32878 7320408 1f32878 7320408 1f32878 7320408 1f32878 7320408 1f32878 7320408 1f32878 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 第一阶段:强制安装完整依赖链
FROM python:3.9-slim AS builder
# 1. 更新CA证书并安装系统工具
RUN apt-get update && apt-get install -y \
ca-certificates \ # 修复HTTPS证书问题
&& rm -rf /var/lib/apt/lists/*
# 2. 安装核心依赖(包含git)
RUN apt-get update && apt-get install -y \
ffmpeg libsndfile1 git \
&& rm -rf /var/lib/apt/lists/*
# 3. 构建OpenVoice(此时git已可用)
WORKDIR /app
COPY OpenVoice/ ./OpenVoice
RUN pip install numpy==1.22.0 && \
pip install -e ./OpenVoice
# 第二阶段:继承所有依赖
FROM python:3.9-slim
COPY --from=builder /usr/bin/git /usr/bin/git # 显式复制git二进制文件
COPY --from=builder /app/OpenVoice /app/OpenVoice
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
# 安装主程序依赖
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 7860
CMD ["python", "app.py"] |