FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 # Prevent interactive prompts ENV DEBIAN_FRONTEND=noninteractive ENV NVIDIA_VISIBLE_DEVICES=all ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility # 1. Install Python 3.12 and SoX dependencies RUN apt-get update && apt-get install -y software-properties-common && \ add-apt-repository ppa:deadsnakes/ppa -y && \ apt-get update && apt-get install -y \ python3.12 \ python3.12-dev \ curl \ git \ libsndfile1 \ ffmpeg \ sox \ libsox-dev && \ rm -rf /var/lib/apt/lists/* # 2. Use the official bootstrap to install a clean Pip for 3.12 RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 WORKDIR /app # 3. Explicitly install BOTH torch and torchaudio from the cu124 index RUN python3.12 -m pip install --no-cache-dir torch==2.6.0 torchaudio --index-url https://download.pytorch.org/whl/cu124 RUN python3.12 -m pip install --no-cache-dir fastapi uvicorn numpy soundfile # 4. Install the local Qwen3-TTS requirements RUN python3.12 -m pip install --no-cache-dir faster-qwen3-tts COPY tts-server.py . EXPOSE 8002 CMD ["python3.12", "tts-server.py"]