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 CPU first (2.6.0 available for CPU) # RUN pip install --no-cache-dir torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 RUN pip install --no-cache-dir typing-extensions==4.10.0 RUN pip install --no-cache-dir \ torch==2.6.0+cpu \ torchvision==0.21.0+cpu \ torchaudio==2.6.0+cpu \ --index-url https://download.pytorch.org/whl/cpu # Install the rest of requirements RUN pip install --no-cache-dir -r requirements.txt # Download NLTK data required by g2p_en RUN python -c "import nltk; nltk.download('averaged_perceptron_tagger_eng', quiet=True)" # Copy application files COPY . . EXPOSE 7860 ENV PYTHONUNBUFFERED=1 # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]