From 27663156af3296e779f9e4f1c9cbcde1aaebf352 Mon Sep 17 00:00:00 2001 From: Alex Hagiopol Date: Wed, 20 Jul 2016 19:14:22 -0700 Subject: [PATCH] Giant fix for Docker run failure due to lack of Ecto. Configure.sh is not finalized. --- .dockerignore | 2 +- Dockerfile | 18 ++++++- configure.sh | 115 ++++++++++++++++++++++---------------------- packages.Dockerfile | 6 --- 4 files changed, 74 insertions(+), 67 deletions(-) diff --git a/.dockerignore b/.dockerignore index c849bb2b..725f2a8a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ Dockerfile tests/test_data SuperBuild/build +build opensfm pmvs odm_orthophoto @@ -8,4 +9,3 @@ odm_texturing odm_meshing odm_georeferencing images_resize -build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5dab7c2b..7f5dea63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +#Pull in previously built packages image with lots of libraries. FROM packages # Prepare directories` @@ -5,7 +6,20 @@ RUN mkdir /code WORKDIR /code # Add repository files -ADD . /code/ +ADD ccd_defs_check.py /code/ccd_defs_check.py +ADD CMakeLists.txt /code/CMakeLists.txt +ADD configure.sh /code/configure.sh +ADD /.git/ /code/.git/ +ADD .gitignore /code/.gitignore +ADD .gitmodules /code/.gitmodules +ADD /modules/ /code/modules/ +ADD /opendm/ /code/opendm/ +ADD /patched_files/ /code/patched_files/ +ADD run.py /code/run.py +ADD /scripts/ /code/scripts/ +ADD /SuperBuild/cmake/ /code/SuperBuild/cmake/ +ADD /SuperBuild/CMakeLists.txt /code/SuperBuild/CMakeLists.txt +ADD /tests/ /code/tests/ # Update submodules RUN git submodule init && git submodule update @@ -16,10 +30,10 @@ RUN bash ./configure.sh #Make build folder RUN mkdir build && cd build && cmake .. && make +#Set environment variables ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages" ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm" ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" -ENV SESSION="DDODMMAP_SESSION" # Entry point ENTRYPOINT ["python", "/code/run.py", "--project-path", "/code/"] diff --git a/configure.sh b/configure.sh index 5c16a625..db0a677d 100755 --- a/configure.sh +++ b/configure.sh @@ -1,27 +1,26 @@ #!/bin/bash - # Check OS -if [ ! $(command -v apt-get) ]; then - echo -e "\e[1;31mERROR: Not a Debian-based linux system. - Impossible to install OpenCV with this script\e[0;39m" - exit 1 -fi +#if [ ! $(command -v apt-get) ]; then +# echo -e "\e[1;31mERROR: Not a Debian-based linux system. +# Impossible to install OpenCV with this script\e[0;39m" +# exit 1 +#fi ## Before installing -echo -e "\e[1;34mUpdating the system\e[0;39m" +#echo -e "\e[1;34mUpdating the system\e[0;39m" sudo apt-get update -END_CMD1=$? +#END_CMD1=$? # sudo apt-get upgrade -y # END_CMD2=$? -if [ $END_CMD1 -ne 0 ] -then - echo -e "\e[1;31mERROR: \e[39mWhen Updating the system\e[0m" - exit 1 -fi +#if [ $END_CMD1 -ne 0 ] +#then +# echo -e "\e[1;31mERROR: \e[39mWhen Updating the system\e[0m" +# exit 1 +#fi ## Install Required Requisites -echo -e "\e[1;34mInstalling Required Requisites\e[0;39m" -sudo apt-get install build-essential \ +#echo -e "\e[1;34mInstalling Required Requisites\e[0;39m" +sudo apt-get install -y build-essential \ cmake \ git \ python-pip \ @@ -30,21 +29,21 @@ sudo apt-get install build-essential \ libgeotiff-dev \ pkg-config -y -qq -# If we have ubuntu version 14.04, the cmake version in apt-get is too low for mvs-texturing. -if [[ `lsb_release -rs` == "14.04" ]]; -then - bash upgradecmake.sh -fi +# Upgrade CMake for mvs-texturing +sudo apt-get install -y software-properties-common python-software-properties +sudo add-apt-repository ppa:george-edison55/cmake-3.x -y +sudo apt-get update -y +sudo apt-get install cmake -y -if [ $? -ne 0 ] -then - echo -e "\e[1;31mERROR: \e[39mWhen Installing Required Requisites\e[0m" - exit 1 -fi +#if [ $? -ne 0 ] +#then +# echo -e "\e[1;31mERROR: \e[39mWhen Installing Required Requisites\e[0m" +# exit 1 +#fi ## Installing Optional Requisites -echo -e "\e[1;34mInstalling OpenCV Dependencies\e[0;39m" -sudo apt-get install libgtk2.0-dev \ +#echo -e "\e[1;34mInstalling OpenCV Dependencies\e[0;39m" +sudo apt-get install -y libgtk2.0-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ @@ -62,19 +61,19 @@ sudo apt-get install libgtk2.0-dev \ liblapack-dev \ libeigen3-dev \ libvtk5-dev -y -qq -if [ $? -ne 0 ] -then - echo -e "\e[1;31mERROR: \e[39mError when Installing Dependencies Requisites\e[0m" - exit 1 -fi +#if [ $? -ne 0 ] +#then +# echo -e "\e[1;31mERROR: \e[39mError when Installing Dependencies Requisites\e[0m" +# exit 1 +#fi ## Remove libdc1394-22-dev due to python opencv issue -echo -e "\e[1;34mRemoving libdc1394-22-dev\e[0;39m" +#echo -e "\e[1;34mRemoving libdc1394-22-dev\e[0;39m" sudo apt-get remove libdc1394-22-dev ## Installing OpenSfM Requisites -echo -e "\e[1;34mInstalling OpenSfM Dependencies\e[0;39m" -sudo apt-get install python-networkx \ +#echo -e "\e[1;34mInstalling OpenSfM Dependencies\e[0;39m" +sudo apt-get install -y python-networkx \ libgoogle-glog-dev \ libsuitesparse-dev \ libboost-filesystem-dev \ @@ -88,45 +87,45 @@ sudo pip install -U PyYAML \ exifread \ gpxpy \ xmltodict -if [ $? -ne 0 ] -then - echo -e "\e[1;31mERROR: \e[39mError when Installing OpenSfM Dependencies\e[0m" - exit 1 -fi +#if [ $? -ne 0 ] +#then +# echo -e "\e[1;31mERROR: \e[39mError when Installing OpenSfM Dependencies\e[0m" +# exit 1 +#fi ## Installing Ecto Requisites -echo -e "\e[1;34mInstalling Ecto Dependencies\e[0;39m" +#echo -e "\e[1;34mInstalling Ecto Dependencies\e[0;39m" sudo pip install -U catkin-pkg -sudo apt-get install python-empy \ +sudo apt-get install -y python-empy \ python-nose \ python-pyside -y -qq -if [ $? -ne 0 ] -then - echo -e "\e[1;31mERROR: \e[39mError when Installing Ecto Dependencies\e[0m" - exit 1 -fi +#if [ $? -ne 0 ] +#then +# echo -e "\e[1;31mERROR: \e[39mError when Installing Ecto Dependencies\e[0m" +# exit 1 +#fi ## Installing OpenDroneMap Requisites -echo -e "\e[1;34mInstalling OpenDroneMap Dependencies\e[0;39m" -sudo apt-get install python-pyexiv2 \ +#echo -e "\e[1;34mInstalling OpenDroneMap Dependencies\e[0;39m" +sudo apt-get install -y python-pyexiv2 \ python-scipy \ jhead \ liblas-bin -y -qq -if [ $? -ne 0 ] -then - echo -e "\e[1;31mERROR: \e[39mError when Installing OpenDroneMap Dependencies\e[0m" - exit 1 -fi +#if [ $? -ne 0 ] +#then +# echo -e "\e[1;31mERROR: \e[39mError when Installing OpenDroneMap Dependencies\e[0m" +# exit 1 +#fi ## Get sys vars -NUM_CORES=`grep -c processor /proc/cpuinfo` +#NUM_CORES=`grep -c processor /proc/cpuinfo` ## Add SuperBuild path to the python path -export PYTHONPATH=$PYTHONPATH:`pwd`/SuperBuild/install/lib/python2.7/dist-packages:`pwd`/SuperBuild/src/opensfm +#export PYTHONPATH=$PYTHONPATH:`pwd`/SuperBuild/install/lib/python2.7/dist-packages:`pwd`/SuperBuild/src/opensfm ## Compile SuperBuild cd SuperBuild mkdir -p build && cd build -cmake .. && make -j${NUM_CORES} +cmake .. && make -j8 #${NUM_CORES} -echo -e "\e[1;34mScript finished\e[0;39m" +#echo -e "\e[1;34mScript finished\e[0;39m" diff --git a/packages.Dockerfile b/packages.Dockerfile index b0708e5c..610c8e87 100644 --- a/packages.Dockerfile +++ b/packages.Dockerfile @@ -1,10 +1,4 @@ -#Help for users: -#BUILD COMMAND EXAMPLE: docker build -t alex1 . -#AUTOMATIC RUN COMMAND EXAMPLE: docker run -it -v /home/alex/OpenDroneMap/images:/code/images --rm alex1 -#MANUAL RUN COMMAND EXAMPLE: docker run -it -v /home/alex/OpenDroneMap/images:/code/images --rm --entrypoint bash alex1 - FROM ubuntu:14.04 -MAINTAINER Danilo Bargen MAINTAINER Alex Hagiopol # Env variables