Dockerfile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
  2. ENV DEBIAN_FRONTEND=noninteractive
  3. ENV PYTHONUNBUFFERED=1
  4. ENV COQUI_TTS_CACHE=/models
  5. ENV TORCH_HOME=/models
  6. WORKDIR /app
  7. # Ubuntu repositories
  8. RUN printf 'deb http://archive.ubuntu.com/ubuntu jammy main universe\n\
  9. deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n\
  10. deb http://archive.ubuntu.com/ubuntu jammy-security main universe\n' > /etc/apt/sources.list
  11. # System dependencies
  12. RUN apt-get update && apt-get install -y \
  13. python3 \
  14. python3-pip \
  15. git \
  16. ffmpeg \
  17. espeak-ng \
  18. libsndfile1 \
  19. && rm -rf /var/lib/apt/lists/*
  20. # Upgrade pip
  21. RUN pip3 install --no-cache-dir --upgrade pip
  22. # CUDA-enabled PyTorch
  23. RUN pip3 install --no-cache-dir \
  24. torch \
  25. torchvision \
  26. torchaudio \
  27. --index-url https://download.pytorch.org/whl/cu118
  28. # Install Coqui TTS + server
  29. RUN pip3 install --no-cache-dir \
  30. TTS[all] \
  31. fastapi \
  32. uvicorn
  33. # Create directories
  34. RUN mkdir -p /models /voices
  35. # Ports
  36. EXPOSE 5002
  37. # Optional volume mounts
  38. VOLUME ["/models", "/voices"]
  39. ENTRYPOINT ["python3", "-m", "uvicorn", "tts_server:app", "--host", "0.0.0.0", "--port", "5002"]