# Stage 1: Base Python image FROM python:3.9 as base # Create a user and set environment variables RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" COPY --chown=user . $HOME/app # Set working directory WORKDIR /app # Copy Python dependencies and install them COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir scikit-build RUN pip install --no-cache-dir --upgrade -r requirements.txt COPY --chown=user . /app ENV DEBIAN_FRONTEND=noninteractive USER root RUN apt-get update && apt-get clean RUN apt-get update && apt-get install -y --fix-missing \ python3-opencv \ python3-pip \ ca-certificates \ python3-dev \ git \ wget \ sudo \ ninja-build RUN pip install --no-cache-dir scikit-build # RUN pip install --no-cache-dir --upgrade -r requirements.txt RUN pip install --no-cache-dir tensorboard cmake onnx USER user ENV HOME=/home/user COPY --chown=user . $HOME/app WORKDIR $HOME/app RUN ls -a CMD ["python", "app.py"]