FROM python:3.11.4 # Create a non-root user with a fixed UID RUN useradd -m -u 1000 user # Install system dependencies RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy and install dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application code COPY --chown=user . /app # Switch to non-root user USER user # Expose the port that the app will run on EXPOSE 7860 # Start the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]