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 # Ubuntu repositories 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 # System dependencies RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ git \ ffmpeg \ espeak-ng \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* # Upgrade pip RUN pip3 install --no-cache-dir --upgrade pip # CUDA-enabled PyTorch RUN pip3 install --no-cache-dir \ torch \ torchvision \ torchaudio \ --index-url https://download.pytorch.org/whl/cu118 # Install Coqui TTS + server RUN pip3 install --no-cache-dir \ TTS[all] \ fastapi \ uvicorn # Create directories RUN mkdir -p /models /voices # Ports EXPOSE 5002 # Optional volume mounts VOLUME ["/models", "/voices"] ENTRYPOINT ["python3", "-m", "uvicorn", "tts_server:app", "--host", "0.0.0.0", "--port", "5002"]