diff --git a/Dockerfile.iridescence b/Dockerfile.iridescence new file mode 100644 index 00000000..985bd1d9 --- /dev/null +++ b/Dockerfile.iridescence @@ -0,0 +1,241 @@ +FROM ubuntu:22.04 +ENV DEBIAN_FRONTEND noninteractive + +# install dependencies via apt +ENV DEBCONF_NOWARNINGS yes +RUN set -x && \ + apt-get update -y -qq && \ + apt-get upgrade -y -qq --no-install-recommends && \ + : "basic dependencies" && \ + apt-get install -y -qq \ + build-essential \ + pkg-config \ + cmake \ + git \ + wget \ + curl \ + tar \ + unzip && \ + : "g2o dependencies" && \ + apt-get install -y -qq \ + libatlas-base-dev \ + libsuitesparse-dev \ + libglew-dev && \ + : "OpenCV dependencies" && \ + apt-get install -y -qq \ + libgtk-3-dev \ + libjpeg-dev \ + libpng++-dev \ + libtiff-dev \ + libopenexr-dev \ + libwebp-dev \ + ffmpeg \ + libavcodec-dev \ + libavformat-dev \ + libavutil-dev \ + libswscale-dev \ + libtbb-dev && \ + : "backward-cpp dependencies" && \ + apt install -y -qq binutils-dev && \ + : "iridescence dependencies" && \ + apt install -y -qq \ + libglm-dev \ + libglfw3-dev \ + libpng-dev \ + libjpeg-dev \ + libeigen3-dev \ + libboost-filesystem-dev \ + libboost-program-options-dev && \ + : "other dependencies" && \ + apt-get install -y -qq \ + libyaml-cpp-dev \ + sqlite3 \ + libsqlite3-dev \ + rsync && \ + : "remove cache" && \ + apt-get autoremove -y -qq && \ + rm -rf /var/lib/apt/lists/* + +ARG CMAKE_INSTALL_PREFIX=/usr/local +ARG NUM_THREADS=1 + +ENV CPATH=${CMAKE_INSTALL_PREFIX}/include:${CPATH} +ENV C_INCLUDE_PATH=${CMAKE_INSTALL_PREFIX}/include:${C_INCLUDE_PATH} +ENV CPLUS_INCLUDE_PATH=${CMAKE_INSTALL_PREFIX}/include:${CPLUS_INCLUDE_PATH} +ENV LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${LIBRARY_PATH} +ENV LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH} + +ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all} +ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics + +# Eigen +ARG EIGEN3_VERSION=3.3.7 +WORKDIR /tmp +RUN set -x && \ + wget -q https://gitlab.com/libeigen/eigen/-/archive/${EIGEN3_VERSION}/eigen-${EIGEN3_VERSION}.tar.bz2 && \ + tar xf eigen-${EIGEN3_VERSION}.tar.bz2 && \ + rm -rf eigen-${EIGEN3_VERSION}.tar.bz2 && \ + cd eigen-${EIGEN3_VERSION} && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \ + .. && \ + make -j${NUM_THREADS} && \ + make install && \ + cd /tmp && \ + rm -rf * +ENV Eigen3_DIR=${CMAKE_INSTALL_PREFIX}/share/eigen3/cmake + +# g2o +ARG G2O_COMMIT=20230223_git +WORKDIR /tmp +RUN set -x && \ + git clone https://github.com/RainerKuemmerle/g2o.git && \ + cd g2o && \ + git checkout ${G2O_COMMIT} && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_UNITTESTS=OFF \ + -DG2O_USE_CHOLMOD=OFF \ + -DG2O_USE_CSPARSE=ON \ + -DG2O_USE_OPENGL=OFF \ + -DG2O_USE_OPENMP=OFF \ + -DG2O_BUILD_APPS=OFF \ + -DG2O_BUILD_EXAMPLES=OFF \ + -DG2O_BUILD_LINKED_APPS=OFF \ + .. && \ + make -j${NUM_THREADS} && \ + make install && \ + cd /tmp && \ + rm -rf * +ENV g2o_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/g2o + +# OpenCV +ARG OPENCV_VERSION=4.7.0 +WORKDIR /tmp +RUN set -x && \ + wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm -rf ${OPENCV_VERSION}.zip && \ + cd opencv-${OPENCV_VERSION} && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \ + -DBUILD_DOCS=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_JASPER=OFF \ + -DBUILD_OPENEXR=OFF \ + -DBUILD_PERF_TESTS=OFF \ + -DBUILD_TESTS=OFF \ + -DBUILD_PROTOBUF=OFF \ + -DBUILD_opencv_apps=OFF \ + -DBUILD_opencv_dnn=OFF \ + -DBUILD_opencv_ml=OFF \ + -DBUILD_opencv_python_bindings_generator=OFF \ + -DENABLE_CXX11=ON \ + -DENABLE_FAST_MATH=ON \ + -DWITH_EIGEN=ON \ + -DWITH_FFMPEG=ON \ + -DWITH_TBB=ON \ + -DWITH_OPENMP=ON \ + .. && \ + make -j${NUM_THREADS} && \ + make install && \ + cd /tmp && \ + rm -rf * +ENV OpenCV_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/opencv4 + +# backward-cpp +ARG BACKWARD_CPP_COMMIT=5ffb2c879ebdbea3bdb8477c671e32b1c984beaa +WORKDIR /tmp +RUN set -x && \ + git clone https://github.com/bombela/backward-cpp.git && \ + cd backward-cpp && \ + git checkout ${BACKWARD_CPP_COMMIT} && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \ + .. && \ + make -j${NUM_THREADS} && \ + make install && \ + cd /tmp && \ + rm -rf * + +# stella_vslam +COPY . /stella_vslam/ +WORKDIR /stella_vslam/ +RUN set -x && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + .. && \ + make -j${NUM_THREADS} && \ + make install && \ + rm -rf CMakeCache.txt CMakeFiles Makefile cmake_install.cmake example src && \ + chmod -R 777 ./* + +# Build and install Iridescence +ARG IRIDESCENCE_COMMIT=fd0cd952a6e92d52ed4da5a574caf1db2f17c3aa +RUN set -x && \ + git clone https://github.com/koide3/iridescence && \ + cd iridescence && \ + git checkout -q ${IRIDESCENCE_COMMIT} && \ + git submodule update --init --recursive && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \ + .. && \ + make -j && \ + make install && \ + cd /tmp && \ + rm -rf * + +ARG IRIDESCENCE_VIEWER_COMMIT=2ec89382e7b57a9261d2d800f6c735bc6f01cfe6 +WORKDIR /tmp +RUN set -x && \ + git clone https://github.com/stella-cv/iridescence_viewer.git && \ + cd iridescence_viewer && \ + git checkout -q ${IRIDESCENCE_VIEWER_COMMIT} && \ + git submodule update --init --recursive && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \ + .. && \ + make -j${NUM_THREADS} && \ + make install && \ + cd /tmp && \ + rm -rf * + +ARG EXAMPLES_COMMIT=1c0433867cba5d110fd94bbc609468650a2f7885 +WORKDIR / +RUN set -x && \ + git clone https://github.com/stella-cv/stella_vslam_examples.git && \ + cd stella_vslam_examples && \ + git checkout -q ${EXAMPLES_COMMIT} && \ + git submodule update --init --recursive && \ + mkdir -p build && \ + cd build && \ + cmake \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \ + -DUSE_STACK_TRACE_LOGGER=ON \ + .. && \ + make -j${NUM_THREADS} + +WORKDIR /stella_vslam_examples/build/ +ENTRYPOINT ["/bin/bash"]