Dockerfile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
  2. ARG VENV_NAME="cosyvoice"
  3. ENV VENV=$VENV_NAME
  4. ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
  5. ENV DEBIAN_FRONTEN=noninteractive
  6. ENV PYTHONUNBUFFERED=1
  7. SHELL ["/bin/bash", "--login", "-c"]
  8. RUN apt-get update -y --fix-missing
  9. RUN apt-get install -y git build-essential curl wget ffmpeg unzip git git-lfs sox libsox-dev && \
  10. apt-get clean && \
  11. git lfs install
  12. # ==================================================================
  13. # conda install and conda forge channel as default
  14. # ------------------------------------------------------------------
  15. # Install miniforge
  16. RUN wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O ~/miniforge.sh && \
  17. /bin/bash ~/miniforge.sh -b -p /opt/conda && \
  18. rm ~/miniforge.sh && \
  19. ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
  20. echo "source /opt/conda/etc/profile.d/conda.sh" >> /opt/nvidia/entrypoint.d/100.conda.sh && \
  21. echo "source /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
  22. echo "conda activate ${VENV}" >> /opt/nvidia/entrypoint.d/110.conda_default_env.sh && \
  23. echo "conda activate ${VENV}" >> $HOME/.bashrc
  24. ENV PATH /opt/conda/bin:$PATH
  25. RUN conda config --add channels conda-forge && \
  26. conda config --set channel_priority strict
  27. # ------------------------------------------------------------------
  28. # ~conda
  29. # ==================================================================
  30. RUN conda create -y -n ${VENV} python=3.10
  31. ENV CONDA_DEFAULT_ENV=${VENV}
  32. ENV PATH /opt/conda/bin:/opt/conda/envs/${VENV}/bin:$PATH
  33. WORKDIR /workspace
  34. ENV PYTHONPATH="${PYTHONPATH}:/workspace/CosyVoice:/workspace/CosyVoice/third_party/Matcha-TTS"
  35. RUN git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git
  36. RUN conda activate ${VENV} && conda install -y -c conda-forge pynini==2.1.5
  37. RUN conda activate ${VENV} && cd CosyVoice && \
  38. pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
  39. WORKDIR /workspace/CosyVoice