From 47d5401448e7e6a4d9deda9b10cb44cda3e3fb1f Mon Sep 17 00:00:00 2001 From: Sergio Bromberg Date: Mon, 4 Sep 2023 16:08:46 +0900 Subject: [PATCH] Create Dockerfile --- Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..45b9c85 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +# Use the base image with PyTorch and CUDA support +FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel + + +# NOTE: +# Building the libraries for this repository requires cuda *DURING BUILD PHASE*, therefore: +# - The default-runtime for container should be set to "nvidia" in the deamon.json file. See this: https://github.com/NVIDIA/nvidia-docker/issues/1033 +# - For the above to work, the nvidia-container-runtime should be installed in your host. Tested with version 1.14.0-rc.2 +# - Make sure NVIDIA's drivers are updated in the host machine. Tested with 525.125.06 + +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install tzdata separately +RUN apt update && apt install -y tzdata + +# Install necessary packages +RUN apt install -y git && \ + apt install -y libglew-dev libassimp-dev libboost-all-dev libgtk-3-dev libopencv-dev libglfw3-dev libavdevice-dev libavcodec-dev libeigen3-dev libxxf86vm-dev libembree-dev && \ + apt clean && apt install wget && rm -rf /var/lib/apt/lists/* + +# Create a workspace directory and clone the repository +WORKDIR /workspace +RUN git clone https://github.com/graphdeco-inria/gaussian-splatting --recursive + +# Create a Conda environment and activate it +WORKDIR /workspace/gaussian-splatting + +RUN conda env create --file environment.yml && conda init bash && exec bash && conda activate gaussian_splatting + +# Tweak the CMake file for matching the existing OpenCV version. Fix the naming of FindEmbree.cmake +WORKDIR /workspace/gaussian-splatting/SIBR_viewers/cmake/linux +RUN sed -i 's/find_package(OpenCV 4\.5 REQUIRED)/find_package(OpenCV 4.2 REQUIRED)/g' dependencies.cmake +RUN sed -i 's/find_package(embree 3\.0 )/find_package(EMBREE)/g' dependencies.cmake +RUN mv /workspace/gaussian-splatting/SIBR_viewers/cmake/linux/Modules/FindEmbree.cmake /workspace/gaussian-splatting/SIBR_viewers/cmake/linux/Modules/FindEMBREE.cmake + +# Fix the naming of the embree library in the rayscaster's cmake +RUN sed -i 's/\bembree\b/embree3/g' /workspace/gaussian-splatting/SIBR_viewers/src/core/raycaster/CMakeLists.txt + +# Ready to build the viewer now. +WORKDIR /workspace/gaussian-splatting/SIBR_viewers +RUN cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release && \ + cmake --build build -j24 --target install +