Skip to content

Instantly share code, notes, and snippets.

@oguzhanmeteozturk
Created November 17, 2022 14:26
Show Gist options
  • Save oguzhanmeteozturk/4472ad0f3b3b238bec45b12fe235bb6d to your computer and use it in GitHub Desktop.
Save oguzhanmeteozturk/4472ad0f3b3b238bec45b12fe235bb6d to your computer and use it in GitHub Desktop.
# ##############################################################################
# Setup Nvidia Container
# ##############################################################################
FROM nvcr.io/nvidia/deepstream-l4t:6.0.1-triton as deepstream-devel
# # Accept default answers for everything
ARG DEBIAN_FRONTEND=noninteractive
# Fix CUDA info
ARG DPKG_STATUS
RUN echo "$DPKG_STATUS" >> /var/lib/dpkg/status
# Install apt-fast
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:apt-fast/stable && \
apt-get update && \
apt-get install -y apt-fast && \
apt-fast install -y --no-install-recommends ca-certificates curl gnupg2 apt-utils
# Update environment
ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs
RUN ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# ##############################################################################
# Install Python and Pip
# ##############################################################################
FROM deepstream-devel as builder
# Configuration Arguments
ARG V_PYTHON_MAJOR=3
ARG V_PYTHON_MINOR=6
ENV V_PYTHON=${V_PYTHON_MAJOR}.${V_PYTHON_MINOR}
# Accept default answers for everything
ARG DEBIAN_FRONTEND=noninteractive
# Download Common Software
RUN apt-get update && \
apt-fast install -y clang build-essential autoconf bash ca-certificates git \
wget curl software-properties-common ffmpeg libsm6 libxext6 \
libffi-dev libssl-dev xz-utils zlib1g-dev liblzma-dev
WORKDIR /install
# Setting up Cmake
RUN curl -sLO --show-error https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3-linux-aarch64.sh && \
chmod +x cmake-3.24.3-linux-aarch64.sh && \
mkdir -p /opt/cmake && \
bash cmake-3.24.3-linux-aarch64.sh --skip-license --prefix=/opt/cmake && \
ln -s /opt/cmake/bin/* /usr/local/bin
COPY Jetson*Linux_R*aarch64.tbz2 /bsp_files/
RUN cd /bsp_files \
&& tar -jxpf Jetson*Linux_R*aarch64.tbz2 \
&& cd Linux_for_Tegra/nv_tegra \
&& tar -jxpf nvidia_drivers.tbz2 \
&& cp -aprf usr/lib/aarch64-linux-gnu/tegra/libnvbuf*.so.1.0.0 /opt/nvidia/deepstream/deepstream/lib/ \
&& cd /opt/nvidia/deepstream/deepstream/lib/ \
&& rm libnvbufsurface.so libnvbufsurftransform.so \
&& ln -s libnvbuf_utils.so.1.0.0 libnvbuf_utils.so \
&& ln -s libnvbufsurface.so.1.0.0 libnvbufsurface.so \
&& ln -s libnvbufsurftransform.so.1.0.0 libnvbufsurftransform.so
RUN apt-fast install -y libglib2.0-dev libglib2.0-dev-bin python3-gi python-gi-dev libtool \
m4 autoconf automake libgirepository1.0-dev libcairo2-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
WORKDIR /opt/nvidia/deepstream/deepstream/sources
RUN git clone --recursive --branch v1.1.1 -j24 https://github.com/NVIDIA-AI-IOT/deepstream_python_apps
RUN apt-fast install -y python3-dev libpython3-dev
RUN cd deepstream_python_apps/3rdparty/gst-python/ && \
./autogen.sh PYTHON=/usr/bin/python3 && \
make -j 4 && \
make install
RUN if (( $(echo "${V_PYTHON_MINOR} >= 7" | bc -l) )); then \
curl -s --show-error https://bootstrap.pypa.io/get-pip.py | python3 ;\
else \
curl -s --show-error https://bootstrap.pypa.io/pip/${V_PYTHON}/get-pip.py | python3 ;\
fi
WORKDIR /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings
RUN mkdir build && cd build/ && \
cmake .. -DPYTHON_MAJOR_VERSION=${V_PYTHON_MAJOR} \
-DPYTHON_MINOR_VERSION=${V_PYTHON_MINOR} \
-DPIP_PLATFORM=linux_aarch64 \
-DDS_PATH=/opt/nvidia/deepstream/deepstream && \
make -j 4
# Setting up Python
# RUN ln -sf /bin/bash /bin/sh && \
# apt-fast install -y python${V_PYTHON}-dev \
# python${V_PYTHON}-venv python${V_PYTHON}-distutils \
# libpython${V_PYTHON_MAJOR}-dev python${V_PYTHON_MAJOR}-setuptools&& \
# rm /usr/bin/python && \
# rm /usr/bin/python${V_PYTHON_MAJOR} && \
# ln -s $(which python${V_PYTHON}) /usr/bin/python && \
# ln -s $(which python${V_PYTHON}) /usr/bin/python${V_PYTHON_MAJOR} && \
# if (( $(echo "${V_PYTHON_MINOR} >= 7" | bc -l) )); then \
# curl -s --show-error https://bootstrap.pypa.io/get-pip.py | python ;\
# else \
# curl -s --show-error https://bootstrap.pypa.io/pip/3.6/get-pip.py | python ;\
# fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment