# Use NVIDIA CUDA base image with Python 3.10 (for x86_64 systems) FROM nvidia/cuda:11.8-devel-ubuntu22.04 # Set environment variables ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV CUDA_HOME=/usr/local/cuda ENV PATH=${CUDA_HOME}/bin:${PATH} ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} # Install system dependencies RUN apt-get update && apt-get install -y \ python3.10 \ python3.10-dev \ python3-pip \ python3.10-venv \ git \ wget \ curl \ build-essential \ cmake \ ninja-build \ libopencv-dev \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ libgomp1 \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Create symbolic links for python RUN ln -sf /usr/bin/python3.10 /usr/bin/python3 && \ ln -sf /usr/bin/python3.10 /usr/bin/python # Upgrade pip and install build tools RUN python3 -m pip install --upgrade pip setuptools wheel # Install Cython first (required for some packages) RUN pip install Cython==3.1.2 # Install PyTorch with CUDA 11.8 support RUN pip install torch==2.7.1+cu128 torchvision==0.22.1+cu128 torchaudio==2.7.1+cu128 \ --index-url https://download.pytorch.org/whl/cu128 # Install ninja (required for detectron2 compilation) RUN pip install ninja==1.11.1.4 # Install fvcore and other detectron2 dependencies RUN pip install fvcore==0.1.5.post20221221 \ opencv-python==4.11.0.86 \ matplotlib==3.9.4 # Install COCO API (pycocotools) - using the Windows-compatible version you used RUN git clone https://github.com/philferriere/cocoapi.git && \ cd cocoapi/PythonAPI && \ python setup.py build_ext --inplace && \ python setup.py install && \ cd / && rm -rf cocoapi # Install detectron2 from source (matching your successful installation) RUN pip install --no-build-isolation 'git+https://github.com/facebookresearch/detectron2.git' # Install remaining requirements COPY requirements.txt /tmp/requirements.txt RUN pip install -r /tmp/requirements.txt # Create working directory WORKDIR /app # Copy your application files COPY FINAL.py /app/ COPY speedtrack.py /app/ # Create necessary directories RUN mkdir -p /app/xpctest /app/output_json /app/ins /app/xpc # Set up runtime environment ENV PYTHONPATH=/app:$PYTHONPATH # Expose any ports if needed (uncomment if you add a web interface) # EXPOSE 8000 # Default command CMD ["python", "FINAL.py"]