FROM python:3.9 # Install ffmpeg RUN apt-get update && \ apt-get install -y ffmpeg && \ rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /code # Copy requirements file COPY ./requirements.txt /code/requirements.txt # Install Python dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create a non-root user RUN useradd -m -u 1000 user # Switch to the non-root user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set working directory for the user WORKDIR $HOME/app # Copy application code COPY --chown=user . $HOME/app # Run the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]