From c880c0756e55cc5d86cba93eadee61a16ab6b169 Mon Sep 17 00:00:00 2001 From: Alex Hagiopol Date: Tue, 19 Jul 2016 11:13:56 -0700 Subject: [PATCH] Docker setup working, but needs user fix and better readme Former-commit-id: ce725e724b028b794881685ad5910acf81e10587 --- .dockerignore | 11 ++++-- Dockerfile | 83 +++++++++++++-------------------------------- README.md | 8 ++++- packages.Dockerfile | 64 ++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 63 deletions(-) create mode 100644 packages.Dockerfile diff --git a/.dockerignore b/.dockerignore index f8457a6a..c849bb2b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,11 @@ Dockerfile tests/test_data SuperBuild/build -SuperBuild/download -SuperBuild/install -SuperBuild/src \ No newline at end of file +opensfm +pmvs +odm_orthophoto +odm_texturing +odm_meshing +odm_georeferencing +images_resize +build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f35ac0a2..fb42f39c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,61 +1,22 @@ -FROM ubuntu:14.04 -MAINTAINER Danilo Bargen +#HELP FOR USERS: Replace example file paths with your own in the example commands below: +#BUILD COMMAND: docker build -t odm . +#AUTOMATIC RUN COMMAND: +# docker run -it --rm \ +# -v $(pwd)/images:/code/images \ +# -v $(pwd)/odm_orthophoto:/code/odm_orthophoto \ +# -v $(pwd)/odm_texturing:/code/odm_texturing \ +# --user odm_user +# odm_image +#MANUAL RUN COMMAND: docker run -it -v /home/alex/OpenDroneMap/images:/code/images --rm --entrypoint bash odm +#WORK INSIDE DOCKER IMAGE: docker run -it -v `pwd`:/code/ --rm --entrypoint bash odm +#REBUILD PACKAGES: docker build -t packages -f packages.Dockerfile . -# Env variables -ENV DEBIAN_FRONTEND noninteractive - -# Install dependencies -RUN apt-get update \ - && sudo apt-get remove libdc1394-22-dev \ - && apt-get install -y --install-recommends \ - build-essential \ - cmake \ - git \ - python-pip \ - libgdal-dev \ - libgeotiff-dev \ - pkg-config \ - libgtk2.0-dev \ - libavcodec-dev \ - libavformat-dev \ - libswscale-dev \ - python-dev \ - python-numpy \ - libtbb2 \ - libtbb-dev \ - libjpeg-dev \ - libpng-dev \ - libtiff-dev \ - libjasper-dev \ - libflann-dev \ - libproj-dev \ - libxext-dev \ - liblapack-dev \ - libeigen3-dev \ - libvtk5-dev \ - python-networkx \ - libgoogle-glog-dev \ - libsuitesparse-dev \ - libboost-filesystem-dev \ - libboost-iostreams-dev \ - libboost-regex-dev \ - libboost-python-dev \ - libboost-date-time-dev \ - libboost-thread-dev \ - python-empy \ - python-nose \ - python-pyside \ - python-pyexiv2 \ - python-scipy \ - jhead \ - liblas-bin \ - && apt-get autoremove \ - && apt-get clean +FROM packages # Add users RUN useradd -m -U odm -# Prepare directories +# Prepare directories` RUN mkdir /code WORKDIR /code @@ -67,14 +28,18 @@ RUN git submodule init && git submodule update # Build OpenDroneMap RUN bash ./configure.sh && \ - mkdir build && cd build && cmake .. && make && cd .. && \ chown -R odm:odm /code + +#Make build folder +RUN mkdir build && cd build && cmake .. && make + USER odm -ENV PYTHONPATH=${PYTHONPATH}:/code/SuperBuild/install/lib/python2.7/dist-packages:/code/SuperBuild/src/opensfm \ - LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/code/SuperBuild/install/lib +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 -VOLUME ["/images"] -# WORKDIR /images -ENTRYPOINT ["python", "/code/run.py", "--project-path", "/images"] +# VOLUME ["/code/images"] +ENTRYPOINT ["python", "/code/run.py", "--project-path", "/code/"] diff --git a/README.md b/README.md index 2825c97a..7f4e9108 100644 --- a/README.md +++ b/README.md @@ -128,8 +128,14 @@ You can also view the orthophoto GeoTIFF in QGIS or other mapping software: #### Using Docker -You can build and run OpenDroneMap in a Docker container: +OpenDroneMap is Dockerized, meaning you can use containerization to build and run it without manually performing the +installation procedure described above and - most importantly - without tampering with the libraries and packages already +installed on your machine. Docker software is free to install and use in this context. If you don't have it installed, +see the [Docker Ubuntu installation tutorial] (https://docs.docker.com/engine/installation/linux/ubuntulinux/) and follow the +instructions up until "Create a Docker group" inclusive. Once Docker is installed, an OpenDroneMap Docker image can be created +as follows: + git clone export IMAGES=/absolute/path/to/your/project docker build -t opendronemap:latest . docker run -v $IMAGES:/images opendronemap:latest diff --git a/packages.Dockerfile b/packages.Dockerfile new file mode 100644 index 00000000..b0708e5c --- /dev/null +++ b/packages.Dockerfile @@ -0,0 +1,64 @@ +#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 +ENV DEBIAN_FRONTEND noninteractive + +# Install dependencies +RUN apt-get update \ + && sudo apt-get remove libdc1394-22-dev \ + && apt-get install -y \ + build-essential \ + cmake \ + git \ + python-pip \ + libgdal-dev \ + libgeotiff-dev \ + pkg-config \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + python-dev \ + python-numpy \ + libtbb2 \ + libtbb-dev \ + libjpeg-dev \ + libpng-dev \ + libtiff-dev \ + libjasper-dev \ + libflann-dev \ + libproj-dev \ + libxext-dev \ + liblapack-dev \ + libeigen3-dev \ + libvtk5-dev \ + python-networkx \ + libgoogle-glog-dev \ + libsuitesparse-dev \ + libboost-filesystem-dev \ + libboost-iostreams-dev \ + libboost-regex-dev \ + libboost-python-dev \ + libboost-date-time-dev \ + libboost-thread-dev \ + python-empy \ + python-nose \ + python-pyside \ + python-pyexiv2 \ + python-scipy \ + jhead \ + liblas-bin \ + python-matplotlib \ + libatlas-base-dev \ + libatlas3gf-base + +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"