Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # FROM must be called before other ARGS except for ARG BASE_IMAGE
- ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r35.1.0
- FROM nvcr.io/nvidia/l4t-base:r35.1.0
- # For the rest of this Dockerfile
- SHELL ["/bin/bash", "-c"]
- # Required build args, should be specified in docker_build.sh
- ARG CONDA_SUFFIX
- ARG CMAKE_VERSION
- ARG PYTHON_VERSION
- ARG DEVELOPER_BUILD
- RUN if [ -z "${CONDA_SUFFIX}" ]; then echo "Error: ARG CONDA_SUFFIX not specified."; exit 1; fi \
- && if [ -z "${CMAKE_VERSION}" ]; then echo "Error: ARG CMAKE_VERSION not specified."; exit 1; fi \
- && if [ -z "${PYTHON_VERSION}" ]; then echo "Error: ARG PYTHON_VERSION not specified."; exit 1; fi \
- && if [ -z "${DEVELOPER_BUILD}" ]; then echo "Error: ARG DEVELOPER_BUILD not specified."; exit 1; fi
- # Prevent interactive inputs when installing packages
- ENV DEBIAN_FRONTEND=noninteractive
- ENV TZ=America/Los_Angeles
- ENV SUDO=command
- RUN \
- touch /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
- echo "deb https://repo.download.nvidia.com/jetson/t194 r35.1 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
- apt-key adv --fetch-key http://repo.download.nvidia.com/jetson/jetson-ota-public.asc && \
- mkdir -p /opt/nvidia/l4t-packages/ && \
- touch /opt/nvidia/l4t-packages/.nv-l4t-disable-boot-fw-update-in-preinstall
- RUN \
- apt-get update && apt-get install -y --assume-yes --verbose-versions --allow-change-held-packages -o Dpkg::Options::="--force-confdef" \
- apt-utils \
- nvidia-jetpack
- ENV UDEV=1
- ENV CUDACXX=/usr/local/cuda/bin/nvcc
- ENV CUDA_HOME=/usr/local/cuda
- ENV PATH=$PATH:/usr/local/cuda/bin/:/opt/nvidia/
- ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
- # Minimal dependencies for running Docker
- # wget : for downloading
- # libgl1 : available on Ubuntu ARM desktop by default
- # libgomp1: available on Ubuntu ARM desktop by default
- RUN apt-get update && apt-get install -y -y --no-install-recommends --assume-yes --verbose-versions --allow-change-held-packages -o Dpkg::Options::="--force-confdef" \
- wget \
- libgl1 \
- libgomp1 \
- && rm -rf /var/lib/apt/lists/*
- # Minimal dependencies for building
- RUN apt-get update && apt-get install -y --no-install-recommends --assume-yes --verbose-versions --allow-change-held-packages -o Dpkg::Options::="--force-confdef" \
- build-essential \
- cmake-gui \
- git \
- && rm -rf /var/lib/apt/lists/*
- # Eigen
- WORKDIR /root
- RUN wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz && tar -xvf eigen-3.4.0.tar.gz && mkdir /root/eigen-3.4.0/build
- WORKDIR /root/eigen-3.4.0
- RUN cd build && cmake \
- -DEIGEN_CUDA_COMPUTE_ARCH=86 \
- -DEIGEN_TEST_CUDA=ON \
- -DEIGEN_TEST_CUDA_CLANG=ON \
- -DEIGEN_TEST_NEON=ON \
- -DEIGEN_TEST_NEON64=ON \
- .. \
- && make install
- WORKDIR /root
- # mininiconda
- ENV PATH="/root/miniconda3/bin:${PATH}"
- RUN wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${CONDA_SUFFIX}.sh \
- && bash Miniconda3-latest-Linux-${CONDA_SUFFIX}.sh -b \
- && rm Miniconda3-latest-Linux-${CONDA_SUFFIX}.sh \
- && conda --version
- ENV PATH="/root/miniconda3/envs/open3d/bin:${PATH}"
- RUN conda create -y -n open3d python=${PYTHON_VERSION} \
- && source activate open3d
- RUN which python \
- && python --version
- # CMake
- # PWD is /, cmake will be installed to /root/${CMAKE_VERSION}/bin/cmake
- RUN CMAKE_VER_NUMBERS=$(echo "${CMAKE_VERSION}" | cut -d"-" -f2) \
- && wget -q https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER_NUMBERS}/${CMAKE_VERSION}.tar.gz \
- && tar -xf ${CMAKE_VERSION}.tar.gz
- # && cp -ar ${CMAKE_VERSION} ${HOME}
- ENV PATH=${HOME}/${CMAKE_VERSION}/bin:${PATH}
- # Install dependencies before copying the full Open3D directory for better Docker caching
- # Open3D C++ dependencies
- COPY ./util/install_deps_ubuntu.sh /root/Open3D/util/
- RUN /root/Open3D/util/install_deps_ubuntu.sh assume-yes \
- && rm -rf /var/lib/apt/lists/*
- RUN echo ${PATH} \
- && echo "gcc=$(which gcc)" \
- && gcc --version \
- && echo "g++=$(which g++)" \
- && g++ --version
- # Python and dependencies
- COPY ./python/requirements*.txt /root/Open3D/python/
- RUN which python \
- && python --version \
- && python -m pip install -U -r /root/Open3D/python/requirements.txt \
- -r /root/Open3D/python/requirements_build.txt \
- -r /root/Open3D/python/requirements_test.txt
- # Open3D repo
- # Always keep /root/Open3D as the WORKDIR
- COPY . /root/Open3D
- WORKDIR /root/Open3D
- # Remove unsupported CUDA arches
- RUN \
- find . -name '*.cmake' -exec sed -i -e 's|60-real 70-real 72-real 75-real 80-real 86|75-real 80-real 86|g' {} \; && \
- find . -name '*.cmake' -exec sed -i -e 's|60-real 70-real 72-real 75-real 80|75-real 80-real 86|g' {} \; && \
- find . -name '*.cmake' -exec sed -i -e 's|30-real 50-real 60-real 70-real 72-real 75|75-real 80-real 86|g' {} \;
- # Build
- # -DCPP_LIBRARY=/usr/lib/llvm-10/lib/libc++.so
- # -CPPABI_LIBRARY=/usr/lib/llvm-10/lib/libc++abi.so
- RUN git submodule update --init --recursive \
- && mkdir build \
- && cd build \
- && cmake \
- -DCMAKE_BUILD_TYPE=Release \
- -DBUILD_UNIT_TESTS=ON \
- -DBUILD_CUDA_MODULE=ON \
- -DCUDAToolkit_BIN_DIR=/usr/local/cuda/bin \
- -DCUDAToolkit_CUPTI_INCLUDE_DIR=/usr/local/cuda/include \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=~/open3d_install \
- -DDEVELOPER_BUILD=${DEVELOPER_BUILD} \
- -DUSE_SYSTEM_EIGEN3=ON \
- -DEigen3_DIR=/usr/local/share/eigen3/cmake \
- -DBUILD_SHARED_LIBS=ON \
- -DBUILD_GUI=ON \
- -DBUILD_TENSORFLOW_OPS=OFF \
- -DBUILD_PYTORCH_OPS=OFF \
- -DUSE_BLAS=ON \
- -DBUILD_FILAMENT_FROM_SOURCE=ON \
- -DCMAKE_CXX_FLAGS_RELEASE=ON \
- -DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG -faligned-new" \
- -DBUILD_LIBREALSENSE=OFF \
- -DUSE_SYSTEM_LIBREALSENSE=OFF \
- .. \
- && make -j$(nproc) \
- && make install-pip-package -j$(nproc) \
- && make install -j$(nproc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement