Sign inSign up

hienanh/jetson

By hienanh

•Updated almost 3 years ago

Image
0

327

hienanh/jetson repository overview

⁠Setup for Ubuntu

  1. Install nvidia-container-runtime:
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update

sudo apt-get install nvidia-container-runtime -y
  1. Edit/create the /etc/docker/daemon.json with content:
{
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
         } 
    },
    "default-runtime": "nvidia",
    "storage-driver": "overlay2"
}
  1. Restart docker daemon:
sudo systemctl restart docker

⁠Version

VersionFROMDescription
hienanh/jetson:0.0.1l4t-base:r32.6.1Full
hienanh/jetson:0.0.2l4t-base:r32.6.1Without onnxruntime
hienanh/jetson:0.0.3hienanh/jetson:0.0.1Install OpenCL on jetson
hienanh/jetson:0.0.4hienanh/jetson:0.0.3Install xtl, xtensor, xtensor-blas
hienanh/jetson:0.0.5nvcr.io/nvidia/l4t-base:r32.6.1(Full) Boost, Gstreamer, curlpp, opencv, libtorch, openssl, cmake 3.22.0, xtensor, opencl, pybind11, onnxruntime
hienanh/jetson:0.0.6nvcr.io/nvidia/l4t-jetpack:r35.1.0(Full) Boost, Gstreamer, curlpp, opencv, libtorch, openssl, cmake 3.22.0, xtensor, opencl, pybind11, onnxruntime

⁠Run

xhost +local:root
docker run -it --rm --net=host --runtime nvidia --name emoi -e DISPLAY=$DISPLAY -p 8000:8000 -v $(pwd):/root/Software -v /tmp/.X11-unix/:/tmp/.X11-unix hienanh/jetson:latest
xhost -local:root

⁠Build Image

docker build -t hienanh/jetson:0.0.1 .

⁠dockefile

  1. Dockerfile for Jetson with CUDA, TensorRT and VisionWorks
Click to expand
FROM nvcr.io/nvidia/l4t-base:r32.6.1
ENV DEBIAN_FRONTEND noninteractive

RUN echo "export PATH=/usr/local/cuda-10.2/bin:\$PATH" >> ~/.bashrc
RUN echo "export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:\$LD_LIBRARY_PATH" >> ~/.bashrc

# Install necessary library
WORKDIR /root
RUN apt update && apt upgrade -y
RUN apt update && apt install --assume-yes software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
RUN apt update && apt install --assume-yes python3.6 python3.6-dev python3-pip
RUN ln -sfn /usr/bin/python3.6 /usr/bin/python3
RUN ln -sfn /usr/bin/python3 /usr/bin/python
RUN ln -sfn /usr/bin/pip3 /usr/bin/pip
RUN apt install --assume-yes git tmux tree wget unzip htop cmake unzip nano g++ python-dev vim
RUN pip3 install -U setuptools
RUN pip3 install jetson-stats
RUN pip3 install setuptools==59.5.0
RUN pip3 install cython

# install boost
RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz -O /root/boost_1_77_0.tar.gz
WORKDIR /root
RUN apt install --assume-yes build-essential autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev
RUN tar -xvzf boost_1_77_0.tar.gz
WORKDIR /root/boost_1_77_0
RUN ./bootstrap.sh --prefix=/usr/ --with-libraries=python && ./b2 --with=all -j$(nproc) install
RUN rm -rf /root/boost_1_77_0
RUN rm -rf /root/boost_1_77_0.tar.gz

# install Gstreamer
WORKDIR /root
RUN apt update
RUN apt upgrade --assume-yes
RUN apt install --assume-yes libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

# install curlpp
WORKDIR /root
RUN apt install --assume-yes libcurl4-openssl-dev
RUN git clone https://github.com/jpbarrette/curlpp.git
RUN mkdir -p curlpp/build && cd curlpp/build
WORKDIR /root/curlpp/build
RUN cmake ..
RUN make -j$(nproc)
RUN make install
RUN rm -rf /root/curlpp

# install opencv
RUN apt purge '*opencv*' -y
RUN apt update
RUN apt upgrade -y
RUN apt install build-essential pkg-config yasm checkinstall libjpeg-dev libpng-dev libtiff-dev  libavcodec-dev libavformat-dev libswscale-dev libavresample-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libxvidcore-dev x264 libx264-dev libfaac-dev libmp3lame-dev libtheora-dev  libfaac-dev libmp3lame-dev libvorbis-dev libopencore-amrnb-dev libopencore-amrwb-dev libdc1394-22 libdc1394-22-dev libxine2-dev libv4l-dev v4l-utils libgtk-3-dev python3-dev python3-pip libtbb-dev libatlas-base-dev gfortran libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen -y
RUN pip3 install -U pip numpy
WORKDIR /usr/include/linux
RUN ln -s -f ../libv4l1-videodev.h videodev.h

WORKDIR /root
RUN git clone https://github.com/opencv/opencv.git
RUN git clone https://github.com/opencv/opencv_contrib.git
RUN mkdir -p opencv/build

WORKDIR /root/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_EXAMPLES=OFF -D BUILD_opencv_python2=OFF -D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D BUILD_opencv_cudacodec=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_V4L=ON -D WITH_GSTREAMER=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_PC_FILE_NAME=opencv.pc -D OPENCV_ENABLE_NONFREE=ON -D BUILD_SHARED_LIBS=ON -D WITH_FFMPEG=ON -D OPENCV_EXTRA_MODULES_PATH=/root/opencv_contrib/modules ..
RUN make -j$(nproc)
RUN make install
RUN ldconfig
RUN pkg-config --modversion opencv
RUN rm -rf /root/opencv*

# Install darknet
WORKDIR /root
RUN git clone https://github.com/AlexeyAB/darknet.git
WORKDIR /root/darknet
RUN sed -i 's/GPU=0/GPU=1/; s/CUDNN=0/CUDNN=1/; s/OPENCV=0/OPENCV=1/; s/LIBSO=0/LIBSO=1/' Makefile
RUN make -j $(nproc)
RUN ln -sf $(readlink -f include/yolo_v2_class.hpp) /usr/local/include/yolo_v2_class.hpp
RUN ln -sf $(readlink -f libdarknet.so) /usr/local/lib/libdarknet.so

# Install Gstreamer RTSP plugin and OpenSSL
WORKDIR /root
RUN apt install gstreamer1.0-rtsp libgstrtspserver-1.0-dev libssl1* -y

# Install licensepp
WORKDIR /root
RUN git clone https://github.com/amrayn/licensepp
RUN git clone https://github.com/weidai11/cryptopp.git
RUN git clone https://github.com/amraynweb/cryptopp-pem.git
RUN cp cryptopp-pem/* cryptopp/
WORKDIR /root/cryptopp
RUN make -j$(nproc)
RUN make install
WORKDIR /root/licensepp
RUN mkdir build
WORKDIR /root/licensepp/build
RUN cmake ..
RUN make -j$(nproc)
RUN make install
WORKDIR /root
RUN rm -rf licensepp cryptopp cryptopp-pem boost_1_77_0 ripe
RUN echo "export LD_LIBRARY_PATH=/usr/local/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc

# install Pytorch
WORKDIR /root
RUN pip3 install astunparse numpy ninja pyyaml setuptools cmake cffi typing_extensions future six requests dataclasses
RUN git clone --recursive https://github.com/pytorch/pytorch
WORKDIR /root/pytorch
RUN git submodule sync
RUN git submodule update --init --recursive --jobs 0
RUN git reset --hard 8b8012a
# RUN git checkout *oldcommit*
RUN git submodule update --recursive
WORKDIR /root/pytorch
RUN export CMAKE_PREFIX_PATH=/usr
RUN python3 setup.py install
RUN echo "export Torch_DIR=/usr/local/lib/python3.6/dist-packages/torch" >> /root/.bashrc
RUN rm -rf /root/pytorch

# Install g++-9
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt update
RUN apt install gcc-9 g++-9 -y
RUN ln -sf /usr/bin/aarch64-linux-gnu-g++-9 /usr/bin/g++

# Install youtube-dl
RUN apt update
RUN apt install youtube-dl -y
WORKDIR /root

# Install Cmake 3.22.0
WORKDIR /root
RUN wget https://github.com/Kitware/CMake/releases/download/v3.22.0-rc2/cmake-3.22.0-rc2-linux-aarch64.tar.gz
RUN tar xvzf cmake-3.22.0-rc2-linux-aarch64.tar.gz
RUN rm -rf cmake-3.22.0-rc2-linux-aarch64.tar.gz
WORKDIR /usr/bin
RUN ln -sf /root/cmake-3.22.0-rc2-linux-aarch64/bin/cmake cmake
RUN apt-get install libopenblas-dev -y

# Install onnxruntime
RUN python -m pip install pytest onnx
WORKDIR /root
RUN git clone --recursive https://github.com/Microsoft/onnxruntime
WORKDIR /root/onnxruntime
RUN ./build.sh --cuda_home /usr/local/cuda-10.2 --cudnn_home /usr/lib/aarch64-linux-gnu/ --use_cuda --config RelWithDebInfo --build_shared_lib --build_wheel --skip_tests --parallel $(nproc)
WORKDIR /root/onnxruntime/build/Linux/RelWithDebInfo
RUN make install
WORKDIR /root/onnxruntime/build/Linux/RelWithDebInfo/dist
RUN python -m pip install *
RUN rm -rf /root/onnxruntime

# Install OpenCL on Jetson Nano
WORKDIR /root
RUN apt install -y cmake git libclang-10-dev clang-10 llvm-10 make ninja-build ocl-icd-dev zlib1g dialog apt-utils libxml2-dev libclang-cpp10-dev libclang-cpp10 llvm-10-dev libncurses5 ocl-icd-opencl-dev opencl-headers clinfo build-essential pkg-config libtinfo-dev libltdl-dev zlib1g-dev libhwloc-dev libglew-dev libedit-dev clang-format clang-tidy libclang-dev ocl-icd-libopencl1
RUN git clone --single-branch --branch release_1_7 https://github.com/pocl/pocl.git && mkdir -p pocl/build
WORKDIR /root/pocl/build
RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local/pocl/ -DENABLE_CUDA=ON -DLLC_HOST_CPU=armv8 -DHOST_CPU_CACHELINE_SIZE=64 -DENABLE_ICD=1 .. && make -j$(nproc) && make install
RUN make install
RUN mkdir -p /etc/OpenCL/vendors/
RUN printf "/usr/local/pocl/lib/libpocl.so" >> /etc/OpenCL/vendors/pocl.icd
RUN rm -rf /root/pocl

# Install xtensor
WORKDIR /root
RUN git clone https://github.com/xtensor-stack/xtl
WORKDIR /root/xtl
RUN mkdir -p build
WORKDIR /root/xtl/build
RUN cmake ..
RUN make -j$(nproc) && make install
WORKDIR /root
RUN git clone https://github.com/xtensor-stack/xtensor.git
WORKDIR /root/xtensor
RUN mkdir -p build
WORKDIR /root/xtensor/build
RUN cmake ..
RUN make -j$(nproc) && make install
WORKDIR /root
RUN git clone https://github.com/xtensor-stack/xtensor-blas.git
WORKDIR /root/xtensor-blas
RUN mkdir -p build
WORKDIR /root/xtensor-blas/build
RUN cmake ..
RUN make -j$(nproc) && make install
WORKDIR /root
RUN rm -rf xtl xtensor xtensor-blas

WORKDIR /root
  1. Dockerfile for Jetson with CUDA, TensorRT and VisionWorks r32.6.1 (**NEW**)
Click to expand
FROM nvcr.io/nvidia/l4t-base:r32.6.1
ENV DEBIAN_FRONTEND noninteractive

RUN echo "export PATH=/usr/local/cuda-10.2/bin:\$PATH" >> ~/.bashrc
RUN echo "export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:\$LD_LIBRARY_PATH" >> ~/.bashrc

# Install necessary library
WORKDIR /root
RUN apt update && apt upgrade -y && apt install --assume-yes software-properties-common && apt update && apt install --assume-yes python3.6 python3.6-dev python3-pip && ln -sfn /usr/bin/python3.6 /usr/bin/python3 && ln -sfn /usr/bin/python3 /usr/bin/python && ln -sfn /usr/bin/pip3 /usr/bin/pip && apt install --assume-yes git tmux tree wget unzip htop cmake unzip nano g++ python-dev vim && pip3 install -U setuptools && pip3 install jetson-stats && pip3 install setuptools==59.5.0 && pip3 install cython

# install boost
RUN cd /root && wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz -O /root/boost_1_77_0.tar.gz && \
    apt install --assume-yes build-essential autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev && \
    tar -xvzf boost_1_77_0.tar.gz && \
    cd /root/boost_1_77_0 && \
    rm -rf /usr/lib/cmake/[Bb]oost* && \
    ./bootstrap.sh --prefix=/usr --with-python=python3 && \
    ./b2 stage -j$(nproc) threading=multi link=shared && \
    ./b2 install threading=multi link=shared && \
    cd /root && rm -rf /root/boost_1_77_0 /root/boost_1_77_0.tar.gz

# install Gstreamer
RUN apt update && apt upgrade --assume-yes && \
    apt install --assume-yes libgstreamer1.0-dev \
        libgstreamer-plugins-base1.0-dev \
        libgstreamer-plugins-bad1.0-dev \
        gstreamer1.0-plugins-base \
        gstreamer1.0-plugins-good \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-plugins-ugly \
        gstreamer1.0-libav \
        gstreamer1.0-doc \
        gstreamer1.0-tools \
        gstreamer1.0-x \
        gstreamer1.0-alsa \
        gstreamer1.0-gl \
        gstreamer1.0-gtk3 \
        gstreamer1.0-qt5 \
        gstreamer1.0-pulseaudio

# install curlpp
RUN cd /root && \
    apt install --assume-yes libcurl4-openssl-dev && \
    git clone https://github.com/jpbarrette/curlpp.git && \
    mkdir -p curlpp/build && cd curlpp/build && \
    cd /root/curlpp/build && \
    cmake .. && \
    make -j$(nproc) && \
    make install && \
    cd /root && \
    rm -rf /root/curlpp

# install opencv
ARG OPENCV_VERSION="4.5.5"
# architecture-specific build options
ARG CUDA_ARCH_BIN="5.3,6.2,7.2"
ARG CUDA_ARCH_PTX="5.3,6.2,7.2"
ARG ENABLE_NEON="OFF"

RUN apt purge '*opencv*' -y && \
    apt update && \
    apt upgrade -y && \
    apt install --assume-yes build-essential pkg-config yasm checkinstall libjpeg-dev libpng-dev libtiff-dev \
        libavcodec-dev libavformat-dev libswscale-dev libavresample-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
        libxvidcore-dev x264 libx264-dev libfaac-dev libmp3lame-dev libtheora-dev libfaac-dev libmp3lame-dev libvorbis-dev \
        libopencore-amrnb-dev libopencore-amrwb-dev libdc1394-22 libdc1394-22-dev libxine2-dev libv4l-dev v4l-utils libgtk-3-dev \
        python3-dev python3-pip libtbb-dev libatlas-base-dev gfortran libprotobuf-dev protobuf-compiler libgoogle-glog-dev 
        libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen && \
    pip3 install -U pip numpy && \
    cd /usr/include/linux && \
    ln -s -f ../libv4l1-videodev.h videodev.h && \
    cd /root && \
    git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv.git && mkdir -p opencv/build && \
    git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv_contrib.git && \
    cd /root/opencv/build && \
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_EXAMPLES=OFF -D BUILD_opencv_python2=OFF -D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D BUILD_opencv_cudacodec=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_V4L=ON -D WITH_GSTREAMER=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_PC_FILE_NAME=opencv.pc -D OPENCV_ENABLE_NONFREE=ON -D BUILD_SHARED_LIBS=ON -D WITH_FFMPEG=ON -D OPENCV_EXTRA_MODULES_PATH=/root/opencv_contrib/modules .. && \
    make -j$(nproc) && \
    make install && \
    ldconfig && \
    pkg-config --modversion opencv && \
    cd /root && \
    rm -rf /root/opencv*

# Install Gstreamer RTSP plugin and OpenSSL
RUN apt install gstreamer1.0-rtsp libgstrtspserver-1.0-dev libssl1* -y

# Install g++-9, youtube-dl
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \
    apt update && \
    apt install --assume-yes gcc-9 g++-9 youtube-dl && \
    ln -sf /usr/bin/aarch64-linux-gnu-g++-9 /usr/bin/g++

# Install Cmake 3.22.0
RUN cd /root && \
    wget https://github.com/Kitware/CMake/releases/download/v3.22.0-rc2/cmake-3.22.0-rc2-linux-aarch64.tar.gz && \
    tar xvzf cmake-3.22.0-rc2-linux-aarch64.tar.gz && \
    rm -rf cmake-3.22.0-rc2-linux-aarch64.tar.gz && \
    cd /usr/bin && \
    ln -sf /root/cmake-3.22.0-rc2-linux-aarch64/bin/cmake cmake

# Install xtensor
RUN cd /root && apt-get install libopenblas-dev -y && \
    git clone https://github.com/xtensor-stack/xtl && \
    git clone https://github.com/xtensor-stack/xtensor.git && \
    git clone https://github.com/xtensor-stack/xtensor-blas.git && \
    cd /root/xtl && mkdir -p build && cd /root/xtl/build && cmake .. && make -j$(nproc) && make install && \
    cd /root/xtensor && mkdir -p build && cd /root/xtensor/build && cmake .. && make -j$(nproc) && make install && \
    cd /root/xtensor-blas && mkdir -p build && cd /root/xtensor-blas/build && cmake .. && make -j$(nproc) && make install && \
    cd /root && rm -rf xtl xtensor xtensor-blas

# Install OpenCL on Jetson Nano
RUN cd /root && \
    apt install -y cmake git libclang-10-dev clang-10 llvm-10 make ninja-build ocl-icd-dev zlib1g dialog apt-utils libxml2-dev libclang-cpp10-dev libclang-cpp10 llvm-10-dev libncurses5 ocl-icd-opencl-dev opencl-headers clinfo build-essential pkg-config libtinfo-dev libltdl-dev zlib1g-dev libhwloc-dev libglew-dev libedit-dev clang-format clang-tidy libclang-dev ocl-icd-libopencl1 && \
    git clone --single-branch --branch release_1_7 https://github.com/pocl/pocl.git && \
    mkdir -p pocl/build && cd /root/pocl/build && \
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/pocl/ -DENABLE_CUDA=ON -DLLC_HOST_CPU=armv8 -DHOST_CPU_CACHELINE_SIZE=64 -DENABLE_ICD=1 .. && make -j$(nproc) && make install && \
    mkdir -p /etc/OpenCL/vendors/ && \
    printf "/usr/local/pocl/lib/libpocl.so" >> /etc/OpenCL/vendors/pocl.icd && \
    cd /root && rm -rf /root/pocl

# Pybind11
RUN python -m pip install pytest && \
    cd /root && git clone https://github.com/pybind/pybind11.git && \
    mkdir pybind11/build && cd /root/pybind11/build && \
    cmake .. && make check -j$(nproc) && make install && \
    cd /root && rm -rf pybind11

# Install onnxruntime
RUN python -m pip install pytest onnx && cd /root && \
    git clone --recursive https://github.com/Microsoft/onnxruntime && \
    cd /root/onnxruntime && \
    ./build.sh --cuda_home /usr/local/cuda-10.2 --cudnn_home /usr/lib/aarch64-linux-gnu/ --use_cuda --config RelWithDebInfo --build_shared_lib --build_wheel --skip_tests --parallel $(nproc) && \
    cd /root/onnxruntime/build/Linux/RelWithDebInfo && \
    make install && \
    cd /root/onnxruntime/build/Linux/RelWithDebInfo/dist && \
    python -m pip install * && \
    rm -rf /root/onnxruntime

# install Libtorch
RUN cd /root && \
    wget https://nvidia.box.com/shared/static/fjtbno0vpo676a25cgvuqc1wty0fkkg6.whl -O torch-1.10.0-cp36-cp36m-linux_aarch64.whl && \
    python3 -m pip install torch-1.10.0-cp36-cp36m-linux_aarch64.whl && \
    rm -rf torch-1.10.0-cp36-cp36m-linux_aarch64.whl
RUN echo "export Torch_DIR=/usr/local/lib/python3.6/dist-packages/torch/" >> /root/.bashrc

WORKDIR /root
  1. Dockerfile for Jetson with CUDA, TensorRT and VisionWorks r35.1.0 (**NEW**)
Click to expand
FROM nvcr.io/nvidia/l4t-jetpack:r35.1.0
ENV DEBIAN_FRONTEND noninteractive
ENV CUDA_HOME="/usr/local/cuda"
ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"

# Install necessary library
WORKDIR /root
RUN apt update && apt upgrade -y
RUN apt update && apt install --assume-yes software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt update && \
    apt install --assume-yes python3-pip && \
    apt install --assume-yes git tmux tree wget unzip htop cmake unzip nano g++ python3-dev vim && \
    pip3 install -U setuptools && \
    pip3 install jetson-stats && \
    pip3 install --upgrade setuptools && \
    pip3 install cython

# install boost
RUN cd /root && wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz -O /root/boost_1_77_0.tar.gz && \
    apt install --assume-yes build-essential autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev && \
    tar -xvzf boost_1_77_0.tar.gz && \
    cd /root/boost_1_77_0 && \
    rm -rf /usr/lib/cmake/[Bb]oost* && \
    ./bootstrap.sh --prefix=/usr --with-python=python3 && \
    ./b2 stage -j$(nproc) threading=multi link=shared && \
    ./b2 install threading=multi link=shared && \
    cd /root && rm -rf /root/boost_1_77_0 /root/boost_1_77_0.tar.gz

# install Gstreamer
RUN apt update && \
    apt upgrade --assume-yes && \
    apt install --assume-yes libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev \
        gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
        gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl \
        gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

# Install Gstreamer RTSP plugin and OpenSSL
RUN apt install gstreamer1.0-rtsp libgstrtspserver-1.0-dev libssl1* -y

# install curlpp
RUN cd /root && \
    apt install --assume-yes libcurl4-openssl-dev && \
    git clone https://github.com/jpbarrette/curlpp.git && \
    mkdir -p curlpp/build && cd curlpp/build && \
    cd /root/curlpp/build && \
    cmake .. && \
    make -j$(nproc) && \
    make install && \
    cd /root && \
    rm -rf /root/curlpp

# install opencv
ARG OPENCV_VERSION="4.5.5"
# architecture-specific build options
ARG CUDA_ARCH_BIN="5.3,6.2,7.2,8.7"
ARG CUDA_ARCH_PTX="5.3,6.2,7.2,8.7"
ARG ENABLE_NEON="OFF"

RUN apt purge '*opencv*' -y && \
    apt update && \
    apt upgrade -y && \
    apt install build-essential pkg-config yasm checkinstall libjpeg-dev libpng-dev libtiff-dev  libavcodec-dev \
        libavformat-dev libswscale-dev libavresample-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
        libxvidcore-dev x264 libx264-dev libfaac-dev libmp3lame-dev libtheora-dev  libfaac-dev libmp3lame-dev \
        libvorbis-dev libopencore-amrnb-dev libopencore-amrwb-dev libdc1394-22 libdc1394-22-dev libxine2-dev \
        libv4l-dev v4l-utils libgtk-3-dev python3-dev python3-pip libtbb-dev libatlas-base-dev gfortran \
        libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev \
        libhdf5-dev doxygen -y && \
    pip3 install -U pip numpy protobuf==3.17 && \
    cd /usr/include/linux && \
    ln -s -f ../libv4l1-videodev.h videodev.h && \
    cd /root && \
    git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv.git && mkdir -p opencv/build && \
    git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv_contrib.git

WORKDIR /root/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D CPACK_BINARY_DEB=OFF -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_EXAMPLES=OFF -D BUILD_opencv_python2=OFF \
        -D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON \
        -D BUILD_opencv_cudacodec=ON -D CUDA_ARCH_BIN=${CUDA_ARCH_BIN} -D CUDA_ARCH_PTX=${CUDA_ARCH_PTX} \
        -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON -D WITH_CUBLAS=ON \
        -D WITH_GSTREAMER=ON -D WITH_V4L=ON -D WITH_LIBV4L=ON -D WITH_OPENGL=ON -D WITH_OPENCL=OFF -D WITH_EIGEN=OFF \
        -D ENABLE_NEON=${ENABLE_NEON} \
        -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_PC_FILE_NAME=opencv.pc -D OPENCV_ENABLE_NONFREE=ON -D BUILD_SHARED_LIBS=ON \
        -D WITH_FFMPEG=ON -D WITH_IPP=OFF -D WITH_TBB=ON -D BUILD_TIFF=ON \
        -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF \
        -D OPENCV_EXTRA_MODULES_PATH=/root/opencv_contrib/modules .. && \
    make -j8 && \
    make install && \
    ldconfig && \
    pkg-config --modversion opencv && \
    cd /root && \
    rm -rf /root/opencv*

# Install licensepp
WORKDIR /root
RUN git clone https://github.com/LuongTanDat/licensepp-openssl-crow.git && \
    apt install --assume-yes software-properties-common git cmake g++ zlib* wget libssl1* libssl-dev -y && \
    cd /root/licensepp-openssl-crow/3rdparty/cryptopp && \
    make -j$(nproc) && \
    make install && \
    cd /root/licensepp-openssl-crow/3rdparty/licensepp && \
    mkdir -p build && \
    cd /root/licensepp-openssl-crow/3rdparty/licensepp/build && \
    cmake .. && \
    make -j$(nproc) && \
    make install && \
    cd /root/licensepp-openssl-crow/3rdparty/ripe && \
    mkdir -p build && \
    cd /root/licensepp-openssl-crow/3rdparty/ripe/build && \
    cmake .. && \
    make -j$(nproc) && \
    make install && \
    cd /root && rm -rf licensepp-openssl-crow

# Install g++-9, youtube-dl
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \
    apt update && \
    apt install --assume-yes gcc-9 g++-9 youtube-dl && \
    ln -sf /usr/bin/aarch64-linux-gnu-g++-9 /usr/bin/g++

# Install Cmake 3.22.0
RUN cd /root && \
    wget https://github.com/Kitware/CMake/releases/download/v3.22.0-rc2/cmake-3.22.0-rc2-linux-aarch64.tar.gz && \
    tar xvzf cmake-3.22.0-rc2-linux-aarch64.tar.gz && \
    rm -rf cmake-3.22.0-rc2-linux-aarch64.tar.gz && \
    cd /usr/bin && \
    ln -sf /root/cmake-3.22.0-rc2-linux-aarch64/bin/cmake cmake

# Install xtensor
RUN cd /root && apt-get install libopenblas-dev -y && \
    git clone https://github.com/xtensor-stack/xtl && \
    git clone https://github.com/xtensor-stack/xtensor.git && \
    git clone https://github.com/xt

Tag summary

Content type

Image

Digest

Size

2.3 GB

Last updated

over 4 years ago

docker pull hienanh/jetson