Created
March 19, 2018 19:08
-
-
Save PeterSprague/a831e5109eb62fe8a6ab7eef92d2214b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM amd64/debian:stretch | |
LABEL maintainer="(upstream master branch) OpenDroneMap contributors" | |
LABEL maintainer="(GeoVisionEnvironmental branches) Peter Sprague <peter.sprague@geovisionenvironmental.com>" | |
# git branch amd64-development | |
# Env variables | |
# Enable systemd | |
ENV version 0.0.0-1 | |
ENV INITSYSTEM on | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update && apt-get install -y \ | |
apt-utils \ | |
software-properties-common | |
#Required Requisites | |
# gis included in main debian repo | |
# no arm64 pkgs | |
#RUN add-apt-repository -y ppa:ubuntugis/ppa | |
#no arm64 pkgs | |
#RUN add-apt-repository -y ppa:george-edison55/cmake-3.x | |
#Install tools | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
gcc g++ gfortran \ | |
git \ | |
vim \ | |
wget \ | |
cmake \ | |
curl | |
# debian needs swig which then includes swig3 | |
RUN apt-get install --no-install-recommends -y \ | |
gdal-bin \ | |
libatlas-base-dev \ | |
libavcodec-dev \ | |
libavformat-dev \ | |
libavutil-dev \ | |
libboost-all-dev \ | |
libboost-date-time-dev \ | |
libboost-filesystem-dev \ | |
libboost-iostreams-dev \ | |
libboost-log-dev \ | |
libboost-python-dev \ | |
libboost-regex-dev \ | |
libboost-thread-dev \ | |
libeigen3-dev \ | |
libexiv2-dev \ | |
libflann-dev \ | |
libgdal-dev \ | |
libgeotiff-dev \ | |
libglew-dev \ | |
libgmp-dev \ | |
libgoogle-glog-dev \ | |
libgtk2.0-dev \ | |
libjpeg-dev \ | |
libjsoncpp-dev \ | |
liblapack-dev \ | |
liblas-bin \ | |
libmpfr-dev \ | |
libopenjp2-7-dev \ | |
libpng-dev \ | |
libpng-dev \ | |
libpostproc-dev \ | |
libproj-dev \ | |
libsuitesparse-dev \ | |
libswscale-dev \ | |
libtbb-dev \ | |
libtbb2 \ | |
libtiff-dev \ | |
libtiff5-dev \ | |
libxext-dev \ | |
pkg-config \ | |
python-dev \ | |
python-empy \ | |
python-gdal \ | |
python-matplotlib \ | |
python-networkx \ | |
python-nose \ | |
python-numpy \ | |
python-pip \ | |
python-py \ | |
python-pyexiv2 \ | |
python-pyproj \ | |
python-pyside \ | |
python-pytest \ | |
python-scipy \ | |
python-shapely \ | |
python-wheel \ | |
swig \ | |
zlib1g-dev | |
# libjasper-dev ?needed - not in debian 9 repo | |
# libvtk6-dev \ ? conflict not needed with VTK8 source build | |
# not installed in debian or ubuntu arm64 | |
#RUN apt-get remove libdc1394-22-dev | |
RUN pip install --upgrade pip | |
RUN pip install setuptools | |
RUN pip install -U PyYAML exifread gpxpy xmltodict catkin-pkg appsettings loky | |
RUN pip install -U https://github.com/OpenDroneMap/gippy/archive/v0.3.9.tar.gz | |
#RUN pip install -U https://github.com/gipit/gippy/archive/v1.0.0b1.tar.gz | |
# add Cuda dependencies | |
# includes OpenDroneMap OpenCV w/ Cuda dependencies | |
# https://docs.opencv.org/3.3.1/d6/d15/tutorial_building_tegra_cuda.html#tutorial_building_tegra_cuda_opencv_24X | |
# from nvidia/cudu Dockerfile | |
# https://gitlab.com/nvidia/cuda/raw/ubuntu16.04/9.1/devel/Dockerfile | |
#RUN apt-get update && apt-get install -y --no-install-recommends \ | |
# cuda-libraries-dev-$CUDA_PKG_VERSION \ | |
# cuda-nvml-dev-$CUDA_PKG_VERSION \ | |
# cuda-minimal-build-$CUDA_PKG_VERSION \ | |
# cuda-command-line-tools-$CUDA_PKG_VERSION \ | |
# libnccl-dev=$NCCL_VERSION-1+cuda9.1 | |
#ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs:${LIBRARY_PATH} | |
# include VTK v8.1.0 dependencies | |
# OpenCL --> apt-get install -y ocl-icd-opencl-dev | |
RUN apt-get install --no-install-recommends -y \ | |
libproj-dev \ | |
libtbb-dev \ | |
libtbb2 \ | |
libxt-dev \ | |
ocl-icd-opencl-dev | |
WORKDIR /usr/local/src/VTK | |
RUN mkdir ./VTK-build | |
RUN git clone https://github.com/Kitware/VTK.git | |
# use VTK.git tag v8.1.0 | |
# master gives errors on make | |
RUN cd ./VTK && \ | |
git checkout v8.1.0 | |
RUN cd ./VTK-build && \ | |
cmake ../VTK \ | |
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | |
-DVTK_SMP_IMPLEMENTATION_TYPE=TBB \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DVTK_Group_Rendering=OFF \ | |
-DBUILD_TESTING=OFF \ | |
&& make -j$(nproc) && make install | |
# build CMVS-PMVS outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/OpenDroneMap/CMVS-PMVS.git | |
RUN cd ./CMVS-PMVS && \ | |
git checkout master | |
RUN cd ./CMVS-PMVS/program && mkdir build && cd build && cmake .. && make -j$(nproc) && make install | |
# build PointCloudLibrary outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/PointCloudLibrary/pcl.git | |
RUN cd ./pcl && \ | |
git checkout pcl-1.8.1 | |
RUN cd ./pcl && mkdir build && cd build && \ | |
cmake .. \ | |
-DBUILD_features=ON \ | |
-DBUILD_filters=ON \ | |
-DBUILD_geometry=ON \ | |
-DBUILD_keypoints=ON \ | |
-DBUILD_outofcore=OFF \ | |
-DBUILD_people=OFF \ | |
-DBUILD_recognition=OFF \ | |
-DBUILD_registration=ON \ | |
-DBUILD_sample_consensus=ON \ | |
-DBUILD_segmentation=ON \ | |
-DBUILD_surface_on_nurbs=OFF \ | |
-DBUILD_tools=OFF \ | |
-DBUILD_tracking=ON \ | |
-DBUILD_visualization=OFF \ | |
-DWITH_QT=OFF \ | |
-DBUILD_OPENNI=OFF \ | |
-DBUILD_OPENNI2=OFF \ | |
-DWITH_OPENNI=OFF \ | |
-DWITH_OPENNI2=OFF \ | |
-DWITH_FZAPI=OFF \ | |
-DWITH_LIBUSB=OFF \ | |
-DWITH_PCAP=OFF \ | |
-DWITH_PXCAPI=OFF \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DPCL_VERBOSITY_LEVEL=Error \ | |
&& make -j$(nproc) && make install | |
# build MVS-Texturing outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
#RUN git clone https://github.com/GeoVisionEnvironmental/mvs-texturing.git | |
RUN git clone https://github.com/nmoehrle/mvs-texturing.git | |
RUN cd ./mvs-texturing && \ | |
git checkout master | |
# default ODM -RESEARCH=OFF flag not in current ccmake, removed, ?causing error | |
RUN cd ./mvs-texturing && mkdir build && cd build && cmake .. \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=/usr/local \ | |
&& make -j$(nproc) && make install | |
# build GFlags outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/gflags/gflags.git | |
RUN cd ./gflags && \ | |
git checkout master | |
RUN cd ./gflags && mkdir build && cd build && \ | |
cmake .. \ | |
-DCMAKE_BUILD_TYPE:STRING=Release \ | |
&& make -j$(nproc) && make install | |
# build Ceres outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://ceres-solver.googlesource.com/ceres-solver | |
RUN cd ./ceres-solver && \ | |
git checkout 1.13.0 | |
RUN cd ./ceres-solver && mkdir build && cd build && \ | |
cmake .. \ | |
-DCMAKE_C_FLAGS=-fPIC \ | |
-DCMAKE_CXX_FLAGS=-fPIC \ | |
-DBUILD_EXAMPLES=OFF \ | |
-DBUILD_TESTING=OFF \ | |
&& make -j$(nproc) && make install | |
# build OpenCV outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/opencv/opencv.git | |
RUN cd ./opencv && \ | |
git checkout 3.4.0 | |
RUN cd ./opencv && mkdir build && cd build && \ | |
cmake .. \ | |
-DCMAKE_BUILD_TYPE:STRING=Release \ | |
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | |
-DENABLE_PRECOMPILED_HEADERS=OFF \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_PNG=ON \ | |
-DBUILD_TIFF=ON \ | |
-DBUILD_TBB=ON \ | |
-DBUILD_JPEG=ON \ | |
-DBUILD_JASPER=OFF \ | |
-DBUILD_ZLIB=OFF \ | |
-DBUILD_opencv_core=ON \ | |
-DBUILD_opencv_imgproc=ON \ | |
-DBUILD_opencv_highgui=ON \ | |
-DBUILD_opencv_video=ON \ | |
-DBUILD_opencv_ml=ON \ | |
-DBUILD_opencv_features2d=ON \ | |
-DBUILD_opencv_calib3d=ON \ | |
-DBUILD_opencv_contrib=ON \ | |
-DBUILD_opencv_flann=ON \ | |
-DBUILD_opencv_objdetect=ON \ | |
-DBUILD_opencv_photo=ON \ | |
-DBUILD_opencv_legacy=ON \ | |
-DBUILD_opencv_python=ON \ | |
-DWITH_VTK=OFF \ | |
-DWITH_EIGEN=OFF \ | |
-DWITH_OPENNI=OFF \ | |
-DBUILD_DOCS=OFF \ | |
-DBUILD_opencv_apps=OFF \ | |
-DBUILD_opencv_videostab=OFF \ | |
-DBUILD_opencv_nonfree=OFF \ | |
-DBUILD_opencv_stitching=OFF \ | |
-DBUILD_opencv_world=OFF \ | |
-DBUILD_opencv_superres=OFF \ | |
-DBUILD_opencv_java=OFF \ | |
-DBUILD_opencv_ocl=OFF \ | |
-DBUILD_opencv_ts=OFF \ | |
-DWITH_OPENCL=ON \ | |
-DWITH_CUDA=OFF \ | |
-DBUILD_opencv_gpu=ON \ | |
-DBUILD_EXAMPLES=OFF \ | |
&& make -j$(nproc) && make install | |
# build OpenGV outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/paulinus/opengv.git | |
RUN cd ./opengv && \ | |
git checkout master | |
RUN cd opengv && mkdir build && cd build && \ | |
cmake .. \ | |
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | |
-DBUILD_TESTS=OFF \ | |
-DBUILD_PYTHON=ON \ | |
-DBUILD_ARCH=native \ | |
&& make -j$(nproc) && make install | |
# build OpenSfM outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
#RUN mkdir /code/ && mkdir /code/src | |
#WORKDIR /code/src | |
RUN git clone https://github.com/mapillary/OpenSfM.git | |
RUN cd ./OpenSfM && \ | |
git checkout master | |
RUN cd OpenSfM && \ | |
pip install -r requirements.txt && \ | |
python setup.py build | |
# build Catkin outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/ros/catkin.git | |
RUN cd ./catkin && \ | |
git checkout 0.7.11 | |
RUN cd catkin && mkdir build && cd build && \ | |
cmake .. \ | |
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | |
-DCATKIN_ENABLE_TESTING=OFF \ | |
&& make -j$(nproc) && make install | |
# build Hexer outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/hobu/hexer.git | |
RUN cd ./hexer && \ | |
git checkout master | |
RUN cd hexer && mkdir build && cd build && \ | |
cmake .. \ | |
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | |
&& make -j$(nproc) && make install | |
# build Ecto outside SuperBuild cmake | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/plasmodic/ecto.git | |
RUN cd ./ecto && \ | |
git checkout master | |
RUN cd ecto && mkdir build && cd build && \ | |
cmake .. \ | |
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | |
-DBUILD_DOC=OFF \ | |
-DBUILD_SAMPLES=OFF \ | |
-DCATKIN_ENABLE_TESTING=OFF \ | |
&& make -j$(nproc) && make install | |
# build LASzip outside SuperBuild cmake | |
#WORKDIR /usr/local/src | |
#RUN git clone https://github.com/LASzip/LASzip.git | |
#RUN cd ./LASzip && \ | |
# git checkout master | |
#RUN cd ./LASzip && mkdir build && cd build && \ | |
# cmake .. \ | |
# -DCMAKE_INSTALL_PREFIX=/usr/local \ | |
# && make -j$(nproc) && make install | |
# build PDAL outside SuperBuild cmake | |
# https://www.pdal.io/development/compilation/unix.html | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/PDAL/PDAL.git | |
# master produces gdal errors | |
RUN cd ./PDAL && git checkout 1.6 | |
# for some strange reason needing to run cmake twice to get make target generated | |
# suspect -DWITH_APPS=ON & -DBUILD_PLUGIN_P2G=OFF & -DWITH_GEOTIFF=ON was killing but not in current cmake as option | |
RUN cd PDAL && mkdir build && cd build && cmake .. && \ | |
cmake .. \ | |
-DCMAKE_INSTALL_PREFIX=/usr/local \ | |
-BUILD_PGPOINTCLOUD_TESTS=OFF \ | |
-BUILD_PLUGIN_PCL=ON \ | |
-BUILD_PLUGIN_PGPOINTCLOUD=ON \ | |
-DBUILD_PLUGIN_CPD=OFF \ | |
-DBUILD_PLUGIN_GREYHOUND=OFF \ | |
-DBUILD_PLUGIN_HEXBIN=ON \ | |
-DBUILD_PLUGIN_ICEBRIDGE=OFF \ | |
-DBUILD_PLUGIN_MRSID=OFF \ | |
-DBUILD_PLUGIN_NITF=OFF \ | |
-DBUILD_PLUGIN_OCI=OFF \ | |
-DBUILD_PLUGIN_SQLITE=OFF \ | |
-DBUILD_PLUGIN_RIVLIB=OFF \ | |
-DBUILD_PLUGIN_PYTHON=OFF \ | |
-DENABLE_CTEST=OFF \ | |
-DWITH_LAZPERF=OFF \ | |
-DWITH_LASZIP=OFF \ | |
-DWITH_TESTS=OFF \ | |
&& make -j$(nproc) && make install | |
# build Lidar2dem outside SuperBuild cmake | |
# http://applied-geosolutions.github.io/lidar2dems/doc/installation.html | |
# need to update setup.py --> gdal==2.1.2 or just plain gdal | |
WORKDIR /usr/local/src | |
RUN git clone https://github.com/GeoVisionEnvironmental/lidar2dems.git | |
RUN cd ./lidar2dems && \ | |
git checkout master | |
RUN cd ./lidar2dems && \ | |
./setup.py install | |
# completely nuke the need for SuperBuild cmake build | |
# continues to fail on install, yet individual external software builds fine | |
# Copy repository files | |
#COPY /SuperBuild/CMakeLists.txt /code/SuperBuild/CMakeLists.txt | |
#COPY /SuperBuild/cmake/ /code/SuperBuild/cmake/ | |
# compile code in SuperBuild and root directories | |
# -j7 is max recommended for OpenCV build with Cuda: https://docs.opencv.org/3.3.1/d6/d15/tutorial_building_tegra_cuda.html#tutorial_building_tegra_cuda_opencv_24X | |
# use -j4 for TX2 | |
# only include this for OpenCV make test for development if building OpenCV inside SuperBuild | |
# need to include build directives to activate testing - see gist | |
#RUN mkdir /code/SuperBuild/build && cd /code/SuperBuild/src && git clone https://github.com/opencv/opencv_extra.git | |
# needed because PYTHONPATH & LD_LIBRARY_PATH to SuperBuild is hardcoded into original ODM code | |
# revised opendm/context.py defined file locations, therefore not needed now | |
#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" | |
# added paths for external builds | |
ENV PYTHONPATH="$PYTHONPATH:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages" | |
ENV PYTHONPATH="$PYTHONPATH:/usr/local/src/OpenSfM" | |
# Copy repository files | |
WORKDIR /code | |
COPY ccd_defs_check.py /code/ccd_defs_check.py | |
COPY CMakeLists.txt /code/CMakeLists.txt | |
COPY configure.sh /code/configure.sh | |
COPY /modules/ /code/modules/ | |
COPY /opendm/ /code/opendm/ | |
COPY /patched_files/ /code/patched_files/ | |
COPY run.py /code/run.py | |
COPY run.sh /code/run.sh | |
COPY /scripts/ /code/scripts/ | |
COPY docker.settings.yaml /code/settings.yaml | |
COPY VERSION /code/VERSION | |
WORKDIR /code | |
RUN mkdir build && cd build && cmake .. && make -j$(nproc) | |
# do clean up to slim image | |
# activate once code works completely | |
# only accounts for 48mb | |
#RUN apt-get remove -y \ | |
# build-essential \ | |
# cmake \ | |
# git \ | |
# python-pip | |
# libgl1-mesa-dri \ | |
# ? need for libvtk6-dev to be reinstalled, does it get removed by the above pkgs removal | |
# not needed since VTK-v8.1.0 installed from source | |
#RUN apt-get update && apt-get install -y libvtk6-dev | |
# Cleanup APT | |
#RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
# clean out external source builds | |
# need /code/src/OpenSfM still | |
#RUN rm -rf /usr/local/src/* | |
# Clean Superbuild [original code] | |
#RUN rm -rf /code/SuperBuild/download /code/SuperBuild/src/vtk8 /code/SuperBuild/src/opencv /code/SuperBuild/src/pcl /code/SuperBuild/src/pdal /code/SuperBuild/src/opengv /code/SuperBuild/src/mvstexturing /code/SuperBuild/src/ceres /code/SuperBuild/build/vtk8 /code/SuperBuild/build/opencv | |
# Entry point | |
ENTRYPOINT ["python", "/code/run.py", "code"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment