Update Dockerfile
Browse files- Dockerfile +25 -14
Dockerfile
CHANGED
|
@@ -1,27 +1,38 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
# Cài đặt thư viện hệ thống
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
-
ffmpeg git
|
| 6 |
-
&& git lfs install \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
# 1. Tải mã nguồn
|
| 12 |
-
RUN git clone https://github.com/RVC-Boss/GPT-SoVITS.git .
|
| 13 |
|
| 14 |
-
# 2.
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
# 3. Cài đặt các thư viện
|
|
|
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
-
RUN pip install --no-cache-dir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
# Hugging Face yêu cầu cổng 7860
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
CMD python api_v2.py -a 0.0.0.0 -p 9880 & python webui.py en
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y \
|
| 4 |
+
ffmpeg git cmake build-essential \
|
|
|
|
| 5 |
&& rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
+
# 1. Tải mã nguồn về máy ảo
|
| 10 |
+
RUN git clone --depth 1 https://github.com/RVC-Boss/GPT-SoVITS.git .
|
| 11 |
|
| 12 |
+
# 2. TỰ ĐỘNG SỬA MÃ NGUỒN (Máy sẽ tự làm bước này)
|
| 13 |
+
# Sửa cổng 9874 -> 7860 để Hugging Face không bị Timeout
|
| 14 |
+
RUN sed -i 's/9874/7860/g' webui.py && \
|
| 15 |
+
# Ép dùng CPU thay vì Card đồ họa (CUDA)
|
| 16 |
+
sed -i 's/is_half = True/is_half = False/g' config.py && \
|
| 17 |
+
sed -i 's/device = "cuda"/device = "cpu"/g' config.py
|
| 18 |
|
| 19 |
+
# 3. Cài đặt các thư viện cần thiết
|
| 20 |
+
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
+
RUN pip install --no-cache-dir underthesea
|
| 23 |
+
|
| 24 |
+
# 4. Tải bộ xử lý ngôn ngữ Roberta (Để tránh lỗi OSError bạn gặp lúc nãy)
|
| 25 |
+
RUN mkdir -p GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large && \
|
| 26 |
+
git clone --depth 1 https://huggingface.co/hfl/chinese-roberta-wwm-ext-large /tmp/roberta && \
|
| 27 |
+
cp -r /tmp/roberta/* GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large/ && \
|
| 28 |
+
rm -rf /tmp/roberta
|
| 29 |
+
|
| 30 |
+
# 5. Cài đặt cổng và môi trường
|
| 31 |
+
ENV webui_port=7860
|
| 32 |
+
ENV device=cpu
|
| 33 |
+
ENV is_half=False
|
| 34 |
|
|
|
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
+
# Khởi chạy
|
| 38 |
+
CMD ["python", "api.py","api_2.py" "-a", "0.0.0.0", "-p", "7860"]
|
|
|