Spaces:
Build error
Build error
File size: 1,072 Bytes
7320408 1f32878 7320408 8b7d527 7320408 8b7d527 7320408 8b7d527 7320408 1f32878 7320408 1f32878 7320408 1f32878 7320408 1bcb949 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 34 35 36 37 38 39 40 41 42 |
# 第一阶段:强制安装完整依赖链
FROM python:3.9-slim AS builder
# 1. 更新CA证书并安装系统工具
# RUN apt-get update && apt-get install -y \
# ca-certificates \
# && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
ca-certificates \
libcurl4-openssl-dev \
git \
&& 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
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"] |