ttskinxx / Dockerfile
vipsphi's picture
Update Dockerfile
f3a868a verified
FROM python:3.9-slim
RUN apt-get update && apt-get install -y \
ffmpeg git cmake build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 1. Tải mã nguồn về máy ảo
RUN git clone --depth 1 https://github.com/RVC-Boss/GPT-SoVITS.git .
# 2. TỰ ĐỘNG SỬA MÃ NGUỒN (Máy sẽ tự làm bước này)
# Sửa cổng 9874 -> 7860 để Hugging Face không bị Timeout
RUN sed -i 's/9874/7860/g' webui.py && \
# Ép dùng CPU thay vì Card đồ họa (CUDA)
sed -i 's/is_half = True/is_half = False/g' config.py && \
sed -i 's/device = "cuda"/device = "cpu"/g' config.py
# 3. Cài đặt các thư viện cần thiết
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir underthesea
# 4. Tải bộ xử lý ngôn ngữ Roberta (Để tránh lỗi OSError bạn gặp lúc nãy)
RUN mkdir -p GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large && \
git clone --depth 1 https://huggingface.co/hfl/chinese-roberta-wwm-ext-large /tmp/roberta && \
cp -r /tmp/roberta/* GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large/ && \
rm -rf /tmp/roberta
# 5. Cài đặt cổng và môi trường
ENV webui_port=7860
ENV device=cpu
ENV is_half=False
EXPOSE 7860
# Khởi chạy
CMD ["python", "api.py","api_2.py" "-a", "0.0.0.0", "-p", "7860"]