# Use an official Python runtime as a parent image FROM python:3.8-slim-buster # Set the working directory in the container WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ build-essential \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ libgl1-mesa-glx \ && rm -rf /var/lib/apt/lists/* # Install PyTorch, torchvision, and cudatoolkit RUN pip install torch==1.9.0 torchvision==0.10.0 # Install OpenCV RUN pip install opencv-python # Clone and install Detectron2 RUN git clone https://github.com/facebookresearch/detectron2.git \ && cd detectron2 \ && pip install -e . \ && pip install git+https://github.com/cocodataset/panopticapi.git \ && pip install git+https://github.com/mcordts/cityscapesScripts.git # Clone and setup MaskDINO RUN git clone https://github.com/facebookresearch/MaskDINO.git \ && cd MaskDINO \ && pip install -r requirements.txt # Set CUDA_HOME environment variable ENV CUDA_HOME /usr/local/cuda # Compile CUDA kernel for MSDeformAttn RUN cd /app/MaskDINO/maskdino/modeling/pixel_decoder/ops \ && sh make.sh # Set the default command to execute # when creating a new container CMD ["bash"]