FROM python:3.11-slim # 系统依赖 RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg git build-essential && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # 1. 先装完整 Python 依赖(从本地冻结的精确版本) COPY frozen_requirements.txt . RUN pip install --no-cache-dir -r frozen_requirements.txt # 2. 构建时就 clone CosyVoice 代码(不再运行时 clone) RUN git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git /app/CosyVoice # 3. 复制应用代码 COPY app.py . EXPOSE 7860 CMD ["python", "app.py"]