FROM nvcr.io/nvidia/deepstream:7.1-samples-multiarch

# Install OpenGL and X11 dependencies for glimagesink
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    nvidia-cuda-toolkit \
    libglvnd0 \
    libgl1 \
    libglx0 \
    libgles2 \
    libegl1 \
    libxcb1 \
    libx11-xcb1 \
    libxkbcommon-x11-0 \
    gstreamer1.0-plugins-bad \
    mesa-utils && \
    rm -rf /var/lib/apt/lists/*

# Set environment variables for OpenGL
ENV NVIDIA_DRIVER_CAPABILITIES $NVIDIA_DRIVER_CAPABILITIES,video
ENV DISPLAY :0
ENV FILENAME=nvfull.sh
ENV BMD=bmd_install.sh
# Copy your pipeline script
COPY $FILENAME /app/
RUN chmod +x /app/$FILENAME

COPY ./Drivers/ /drivers/
COPY $BMD /scripts/
RUN chmod +x /scripts/$BMD && \
    cd /scripts && \
    ./$BMD

# Set working directory
WORKDIR /app

# Default command to run your pipeline
CMD ["sh", "-c", "tail -f /dev/null"]
#CMD ["nvidia-smi"]
