gpt-sovits / Dockerfile
huanx's picture
Revert: remove COPY model files, use huggingface_hub download instead
b3bec4e verified
FROM python:3.10-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_NO_CACHE_DIR=1
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake \
ffmpeg libsndfile1 libgomp1 \
curl wget ca-certificates git \
mecab libmecab-dev mecab-ipadic-utf8 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# CPU PyTorch
RUN pip install --no-cache-dir torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu
# Download GPT-SoVITS source
RUN wget -q --timeout=180 \
"https://github.com/RVC-Boss/GPT-SoVITS/archive/refs/heads/main.tar.gz" \
-O /tmp/gsv.tar.gz \
&& tar xzf /tmp/gsv.tar.gz -C /app --strip-components=1 \
&& rm /tmp/gsv.tar.gz
# Install dependencies (patch for CPU, allow partial failure)
RUN cp requirements.txt /tmp/requirements.txt.bak \
&& sed -i 's/onnxruntime-gpu/onnxruntime/; /python_mecab_ko/d' requirements.txt \
&& pip install --no-cache-dir -r requirements.txt || true
# Ensure core packages
RUN pip install --no-cache-dir \
fastapi uvicorn python-multipart gradio \
numpy scipy librosa soundfile pydub ffmpeg-python \
transformers peft sentencepiece tokenizers \
onnxruntime \
pyopenjtalk g2p_en pypinyin cn2an num2words jaconv \
jieba jieba_fast pkuseg \
pydantic PyYAML psutil huggingface_hub tqdm || true
# Copy config and start script
COPY tts_infer_cpu.yaml /app/GPT_SoVITS/configs/tts_infer_cpu.yaml
COPY start.sh /app/start.sh
COPY ui.py /app/ui.py
RUN chmod +x /app/start.sh
RUN mkdir -p /data/models /data/audio /tmp/uploads
EXPOSE 7860
CMD ["/app/start.sh"]