FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ ffmpeg \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Create a non-root user for Hugging Face Spaces security RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy application code COPY --chown=user . $HOME/app # Expose port (Hugging Face Spaces default is 7860) EXPOSE 7860 # Run the application CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]