FROM python:3.12 # Install system dependencies (libgl1) without root permissions RUN apt-get update && \ apt-get install --no-install-recommends -y libgl1 # Create a non-root user RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory WORKDIR /app # Copy the requirements files COPY requirements.txt /app/requirements.txt COPY packages.txt /app/packages.txt # Install Python dependencies (these can be installed without root) RUN pip install --no-cache-dir -r requirements.txt COPY --chown=user . /app # Command to run your FastAPI app (adjust as necessary) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]