FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV COQUI_TTS_CACHE=/models ENV TORCH_HOME=/models WORKDIR /app RUN printf 'deb http://archive.ubuntu.com/ubuntu jammy main universe\n\ deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n\ deb http://archive.ubuntu.com/ubuntu jammy-security main universe\n' > /etc/apt/sources.list RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ git \ ffmpeg \ espeak-ng \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* RUN pip3 install --no-cache-dir --upgrade pip # CUDA Torch (PINNED) RUN pip3 install --no-cache-dir \ torch==2.5.1+cu118 \ torchvision==0.20.1+cu118 \ torchaudio==2.5.1+cu118 \ --index-url https://download.pytorch.org/whl/cu118 # Coqui TTS RUN pip3 install --no-cache-dir \ TTS[all]==0.22.0 \ fastapi \ uvicorn # Transformers version compatible with XTTS RUN pip3 install --no-cache-dir "transformers>=4.30.0,<4.32.0" RUN mkdir -p /models /voices EXPOSE 5002 VOLUME ["/models", "/voices"] ENTRYPOINT ["python3", "-m", "uvicorn", "tts_server:app", "--host", "0.0.0.0", "--port", "5002"]