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