# Use the official Python image from the Docker Hub FROM python:3.9 # Install dependencies for OpenCV, ffmpeg, and other necessary system libraries RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ ffmpeg # Create a user to run the application RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory WORKDIR /app # Copy the requirements.txt and install dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the application code COPY --chown=user . /app # Command to run the FastAPI application with uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]