FROM python:3.11-slim WORKDIR /app # Install system dependencies for audio processing RUN apt-get update && apt-get install -y \ ffmpeg \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install CPU-only PyTorch (Latest Stable) RUN pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu # Install remaining requirements (skip torch/torchaudio since already installed) RUN pip install --no-cache-dir -r requirements.txt || true # Copy application code COPY . . # Expose port (documentary only, but good practice) EXPOSE 8000 # Create user with UID 1000 (required for HF Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Run the application CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]