# Install dependencies RUN apt-get update && apt-get install -y \ python3-dev \ build-essential \ libjpeg-dev \ zlib1g-dev \ libpng-dev \ libglib2.0-0 \ libsm6 \ libxrender1 \ libxext6 \ && rm -rf /var/lib/apt/lists/* # Install dependencies including torch first RUN pip install --no-cache-dir torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu # Then, install other requirements COPY --mount=target=/tmp/requirements.txt,source=requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt # Install Detectron2 from source RUN pip install 'git+https://github.com/facebookresearch/detectron2.git