FROM python:3.10 WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ libffi-dev \ libsndfile1 \ libasound2 \ libxt6 \ && rm -rf /var/lib/apt/lists/* # Copy requirements first to leverage Docker cache COPY requirements.txt . # Install PyTorch and torchaudio (use available version for cu121) # Using 2.5.1 which is the latest stable for cu121 RUN pip install --no-cache-dir torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121 # Install the rest of requirements RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . EXPOSE 7860 ENV PYTHONUNBUFFERED=1 # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]