FROM python:3.10 # Install system dependencies for audio processing AND git RUN apt-get update && apt-get install -y \ ffmpeg \ libsndfile1 \ git \ && rm -rf /var/lib/apt/lists/* # Create a new user named "user" with UID 1000 (required for Hugging Face) RUN useradd -m -u 1000 user # Point home and cache directories to the writable user folder ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ HF_HOME=/home/user/.cache/huggingface # Switch to the non-root user USER user # Set working directory to the user's home app folder WORKDIR $HOME/app # Copy requirements and install them under the user COPY --chown=user requirements.txt requirements.txt RUN pip install --no-cache-dir --user -r requirements.txt # Copy the rest of the application files with proper permissions COPY --chown=user . . # Run the FastAPI server on port 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]