mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-29 09:18:21 +00:00
fix dockerfile
This commit is contained in:
+48
-27
@@ -1,42 +1,63 @@
|
|||||||
|
|
||||||
# Base CUDA image
|
# Base CUDA image
|
||||||
|
|
||||||
FROM cnstark/pytorch:2.0.1-py3.9.17-cuda11.8.0-ubuntu20.04
|
FROM cnstark/pytorch:2.0.1-py3.9.17-cuda11.8.0-ubuntu20.04
|
||||||
|
|
||||||
LABEL maintainer="breakstring@hotmail.com"
|
# Set environment variables
|
||||||
LABEL version="dev-20240209"
|
|
||||||
LABEL description="Docker image for GPT-SoVITS"
|
|
||||||
|
|
||||||
|
|
||||||
# Install 3rd party apps
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV TZ=Etc/UTC
|
ENV TZ=Etc/UTC
|
||||||
|
|
||||||
|
# Create directories for Python installation and model code
|
||||||
|
RUN mkdir -p /python_install /model_code/GPT-SoVITS/GPT_SoVITS/pretrained_models
|
||||||
|
|
||||||
|
# Set the working directory for Python installation
|
||||||
|
WORKDIR /python_install
|
||||||
|
|
||||||
|
# Install necessary packages and git-lfs
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends tzdata ffmpeg libsox-dev parallel aria2 git git-lfs && \
|
apt-get install -y --no-install-recommends \
|
||||||
|
tzdata \
|
||||||
|
ffmpeg \
|
||||||
|
libsox-dev \
|
||||||
|
parallel \
|
||||||
|
aria2 \
|
||||||
|
git \
|
||||||
|
dos2unix \
|
||||||
|
nano \
|
||||||
|
curl \
|
||||||
|
software-properties-common \
|
||||||
|
espeak-ng \
|
||||||
|
sudo \
|
||||||
|
rsync && \
|
||||||
|
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
|
||||||
|
apt-get install -y git-lfs && \
|
||||||
git lfs install && \
|
git lfs install && \
|
||||||
|
add-apt-repository ppa:deadsnakes/ppa && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy only requirements.txt initially to leverage Docker cache
|
# Copy the requirements.txt and install Python dependencies
|
||||||
WORKDIR /workspace
|
COPY requirements.txt /python_install/
|
||||||
COPY requirements.txt /workspace/
|
RUN python3 -m venv python && \
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
. /python_install/python/bin/activate && \
|
||||||
|
python/bin/pip install --upgrade pip wheel setuptools && \
|
||||||
|
python/bin/pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Define a build-time argument for image type
|
# Clone Hugging Face repository and move models
|
||||||
ARG IMAGE_TYPE=full
|
RUN git clone https://huggingface.co/lj1995/GPT-SoVITS /python_install/GPT-SoVITS && \
|
||||||
|
mkdir -p /model_code/GPT-SoVITS/GPT_SoVITS/pretrained_models && \
|
||||||
|
mv /python_install/GPT-SoVITS/* /model_code/GPT-SoVITS/GPT_SoVITS/pretrained_models/
|
||||||
|
|
||||||
# Conditional logic based on the IMAGE_TYPE argument
|
# Move Docker, GPT_SoVITS, requirements.txt, and tools to /model_code/GPT-SoVITS
|
||||||
# Always copy the Docker directory, but only use it if IMAGE_TYPE is not "elite"
|
RUN mv /python_install/requirements.txt /model_code/GPT-SoVITS/
|
||||||
COPY ./Docker /workspace/Docker
|
|
||||||
# elite 类型的镜像里面不包含额外的模型
|
|
||||||
RUN if [ "$IMAGE_TYPE" != "elite" ]; then \
|
|
||||||
chmod +x /workspace/Docker/download.sh && \
|
|
||||||
/workspace/Docker/download.sh && \
|
|
||||||
python /workspace/Docker/download.py && \
|
|
||||||
python -m nltk.downloader averaged_perceptron_tagger cmudict; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# Set the working directory for model code
|
||||||
|
WORKDIR /model_code/GPT-SoVITS
|
||||||
|
|
||||||
# Copy the rest of the application
|
# Copy the remaining contents to the model_code directory
|
||||||
COPY . /workspace
|
COPY . /model_code/GPT-SoVITS
|
||||||
|
|
||||||
EXPOSE 9871 9872 9873 9874 9880
|
# Change working directory to the project folder
|
||||||
|
WORKDIR /model_code/GPT-SoVITS
|
||||||
|
|
||||||
CMD ["python", "webui.py"]
|
# Run an interactive shell by default and activate the virtual environment
|
||||||
|
CMD ["bash", "-c", ". /python_install/python/bin/activate && exec bash"]
|
||||||
|
|||||||
Reference in New Issue
Block a user