Commit db30f8d7 authored by Matt Brown's avatar Matt Brown
Browse files

Add Docker for SfM applications.

parent 456c370e
externalproject_add(ext_mapmap
PREFIX ext_mapmap
GIT_REPOSITORY https://github.com/dthuerck/mapmap_cpu.git
GIT_TAG master
UPDATE_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/elibs/mapmap
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
externalproject_add(ext_rayint
PREFIX ext_rayint
GIT_REPOSITORY https://github.com/nmoehrle/rayint.git
GIT_TAG cuda
UPDATE_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/elibs/rayint
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
externalproject_add(ext_eigen
PREFIX ext_eigen
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.2/eigen-3.3.2.tar.gz
URL_MD5 02edfeec591ae09848223d622700a10b
SOURCE_DIR ${CMAKE_SOURCE_DIR}/elibs/eigen
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
externalproject_add(ext_mve
PREFIX mve
GIT_REPOSITORY https://github.com/nmoehrle/mve.git
UPDATE_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/elibs/mve
CONFIGURE_COMMAND ""
BUILD_COMMAND make -C libs/mve && make -C libs/util #not platform independent
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
NAME=adapt_sfm_postprocessing
TAG="latest"
IMAGENAME="${NAME}:${TAG}"
docker build -t $IMAGENAME -f dockerfile .
FROM ubuntu:18.04
# install packages
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
curl \
git \
sudo \
ca-certificates \
libgtk2.0-0 \
libcanberra-gtk-module \
bzip2 \
libx11-6 \
libxxf86vm1 \
build-essential \
libgl1-mesa-dev xvfb \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libtbb-dev \
cmake \
qt5-default \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user and switch to it. Running X11 applications as root does
# not always work.
RUN adduser --disabled-password --gecos '' --shell /bin/bash user
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
WORKDIR /home/user
# MVS-Texturing
RUN git clone https://github.com/nmoehrle/mvs-texturing.git
COPY CMakeLists.txt /home/user/mvs-texturing/elibs/CMakeLists.txt
RUN cd /home/user/mvs-texturing \
&& mkdir build && cd build && cmake .. \
&& make -j
RUN apt-get update && apt-get install -y --no-install-recommends \
libqt5opengl5-dev \
&& rm -rf /var/lib/apt/lists/*
# MVE
RUN git clone https://github.com/simonfuhrmann/mve.git \
&& cd mve \
&& make -j \
&& cd apps/umve/ \
&& qmake && make -j8
NAME=adapt_sfm_postprocessing
TAG="latest"
IMAGENAME="${NAME}:${TAG}"
CONTAINER_NAME="${NAME}"
# Location of this script.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $DIR/utilities.sh
start_container $IMAGENAME $CONTAINER_NAME
docker exec -it \
-e "DISPLAY" \
-e "QT_X11_NO_MITSHM=1" \
$container_name \
/bin/bash
remove_container $container_name
# Location of this script.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
function remove_container()
{
container_name=$1
if ! [ -z `docker ps -a -q -f name=^/${container_name}$` ]; then
docker stop $container_name
fi
if ! [ -z `docker ps -q -f name=${container_name}` ]; then
docker rm $container_name
fi
}
function start_container()
{
image_name=$1
container_name=$2
if [ -z `docker ps -a -q -f name=^/${container_name}$` ]; then
# If the container does not exist, start it.
echo "Starting new container"
# Open up xhost (for display) only to the container.
xhost +local:`docker inspect --format='{{ .Config.Hostname }}' $container_name`
HOST_UID=$(echo $UID)
HOST_GID=$(id -g)
# Maping /tmp/.X11-unix allows graphics to be passed.
docker run --rm -dt \
-e "DISPLAY" \
-v "/tmp/.X11-unix:/tmp/.X11-unix" \
-v "$DIR/../:/home/user/adapt_postprocessing" \
-v "/media:/media" \
--name $container_name \
$image_name \
/bin/bash
elif [ -z `docker ps -q -f name=${container_name}` ]; then
# If the container exists but is stopped, start it.
echo "Container is stopped, restarting it"
docker start $container_name
else
echo "Container already running"
fi
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment