diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..0f1237c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,75 @@ +FROM tensorflow/tensorflow:latest-gpu + +ARG user_id +ARG root_psw="12345678" +ARG user_psw="ok" +ARG user_name=user + +# Installs the necessary pkgs. +RUN \ + echo "**** packages installation ****" \ + && apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub \ + && apt-get update && apt-get install -y \ + vim \ + build-essential \ + cmake \ + libopencv-dev \ + libjpeg-dev \ + libpng-dev \ + libglew-dev \ + libpthread-stubs0-dev \ + git \ + virtualenv \ + time \ + sudo \ + wget \ + nano \ + python3.8-venv \ + libboost-program-options-dev \ + libboost-filesystem-dev \ + libboost-graph-dev \ + libboost-regex-dev \ + libboost-system-dev \ + libboost-test-dev \ + libeigen3-dev \ + libsuitesparse-dev \ + libfreeimage-dev \ + libgoogle-glog-dev \ + libgflags-dev \ + libglew-dev \ + qtbase5-dev \ + libqt5opengl5-dev \ + libcgal-dev \ + libcgal-qt5-dev \ + libmetis-dev \ + libflann-dev \ + libatlas-base-dev \ + libsuitesparse-dev \ + && echo "**** python pip update ****" \ + && /usr/bin/python3 -m pip install --upgrade pip \ + && echo "**** aliases for l and ll commands creation ****" \ + && echo -e 'ls --color=auto "$@"' > /usr/bin/l \ + && echo -e 'ls -lah --color=auto "$@"' > /usr/bin/ll \ + && chmod +x /usr/bin/ll /usr/bin/l \ + && echo "**** history-search-backward by pressing F8 ****" \ + && sed -i 's/# "\\e\[5~": history-search-backward/"\\e\[19~": history-search-backward/' /etc/inputrc \ + && echo "**** root password creation ****" \ + && echo "root:${root_psw}" | chpasswd \ + && echo "**** user creation ****" \ + && useradd -m -s /usr/bin/bash -u ${user_id} -G sudo ${user_name} \ + && echo "${user_name}:${user_psw}" | chpasswd \ + && chown -R ${user_name}:${user_name} /home/${user_name}/ \ + && mkdir /home/${user_name}/workspace/ \ + && chown -R user:user /home/${user_name}/workspace + + +USER ${user_name} +WORKDIR /home/${user_name}/ + + +#Read/Write: git clone ssh://ics\\ammarkov@cvrlcode.ics.forth.gr:29418/users/ammarkov/ammarkov.git +#Read only: git clone https://ics\\ammarkov@cvrlcode.ics.forth.gr:8443/r/users/ammarkov/ammarkov.git + +RUN git config --global http.sslverify false +RUN cd /home/${user_name}/workspace && git clone --recursive https://github.com/graphdeco-inria/gaussian-splatting && cd gaussian-splatting && ./docker/initialize.sh + diff --git a/docker/build_and_deploy.sh b/docker/build_and_deploy.sh new file mode 100755 index 0000000..a8c97b1 --- /dev/null +++ b/docker/build_and_deploy.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# This script builds and runs a docker image for local use. + +#Although I dislike the use of docker for a myriad of reasons, due needing it to deploy on a particular machine +#I am adding a docker container builder for the repository to automate the process + + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$DIR" +cd .. +REPOSITORY=`pwd` + +cd "$DIR" + +NAME="mocapnet" +dockerfile_pth="$DIR" +mount_pth="$REPOSITORY" + +# update tensorflow image +docker pull tensorflow/tensorflow:latest-gpu + +# build and run tensorflow +docker build \ + -t $NAME \ + $dockerfile_pth \ + --build-arg user_id=$UID + +docker run -d \ + --gpus all \ + --shm-size 8G \ + -it \ + --name $NAME-container \ + -v $mount_pth:/home/user/workspace \ + $NAME + + +docker ps -a + +OUR_DOCKER_ID=`docker ps -a | grep mocapnet | cut -f1 -d' '` +echo "Our docker ID is : $OUR_DOCKER_ID" +echo "Attaching it using : docker attach $OUD_DOCKER_ID" +docker attach $OUR_DOCKER_ID + +exit 0 diff --git a/docker/initialize.sh b/docker/initialize.sh new file mode 100755 index 0000000..ae6d207 --- /dev/null +++ b/docker/initialize.sh @@ -0,0 +1,34 @@ +#!/bin/bash + + +git clone https://ceres-solver.googlesource.com/ceres-solver +cd ceres-solver +git checkout $(git describe --tags) # Checkout the latest release +mkdir build +cd build +cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_CUDA_ARCHITECTURES=native +make +sudo make install +cd .. +cd .. + + +git clone https://github.com/colmap/colmap +cd colmap +git checkout dev +mkdir build +cd build +cmake .. -DCMAKE_CUDA_ARCHITECTURES=native +make +sudo make install +CC=/usr/bin/gcc-6 CXX=/usr/bin/g++-6 cmake .. +cd .. +cd .. + + +pip install -q plyfile + +pip install -q https://huggingface.co/camenduru/gaussian-splatting/resolve/main/diff_gaussian_rasterization-0.0.0-cp310-cp310-linux_x86_64.whl +pip install -q https://huggingface.co/camenduru/gaussian-splatting/resolve/main/simple_knn-0.0.0-cp310-cp310-linux_x86_64.whl + +exit 0