FROM python:3.10-slim RUN useradd -m -u 1000 user USER user ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app COPY --chown=user . $HOME/app RUN pip install --no-cache-dir --upgrade pip USER root RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ g++ \ && rm -rf /var/lib/apt/lists/* USER user RUN pip install --no-cache-dir opencv-python-headless numpy onnxruntime Pillow fastapi uvicorn python-multipart RUN pip install --no-cache-dir -r requirements.txt RUN mkdir -p artifacts/models artifacts/vector_index artifacts/metadata EXPOSE 7860 CMD ["python", "app.py"]