# Dockerfile # 1. Base Image FROM python:3.9-slim # 2. Install system dependencies (ffmpeg, libsndfile) RUN apt-get update && apt-get install -y --no-install-recommends \ libsndfile1 \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # 3. Create a non-root user (Required for Hugging Face Spaces) RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # 4. Set working directory WORKDIR /home/user/app # 5. Copy requirements and install COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --timeout=600 -r requirements.txt # 6. Copy the application code COPY --chown=user . . # 7. Expose the correct port for Hugging Face EXPOSE 7860 # 8. Run with Gunicorn on port 7860 # Note: Increased timeout to 120s because audio processing on CPU can be slow CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120", "app:app"]