├── Dockerfile ├── README.md ├── before_install.sh.patch ├── build.sh ├── gdal-checkout.txt └── install.sh.patch /Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | # geodata/gdal 3 | # 4 | # This creates an Ubuntu derived base image that installs the latest GDAL 5 | # subversion checkout compiled with a broad range of drivers. The build process 6 | # is based on that defined in 7 | # 8 | # 9 | 10 | # Ubuntu 14.04 Trusty Tahyr 11 | FROM ubuntu:trusty 12 | 13 | MAINTAINER Homme Zwaagstra 14 | 15 | # Install the application. 16 | ADD . /usr/local/src/gdal-docker/ 17 | RUN /usr/local/src/gdal-docker/build.sh 18 | 19 | # Externally accessible data is by default put in /data 20 | WORKDIR /data 21 | VOLUME ["/data"] 22 | 23 | # Output version and capabilities by default. 24 | CMD gdalinfo --version && gdalinfo --formats && ogrinfo --formats 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GDAL Docker Images 2 | 3 | NB: As of GDAL version 1.11.2 the image has been renamed from `homme/gdal` to 4 | `geodata/gdal`. 5 | 6 | This is an Ubuntu derived image containing the Geospatial Data Abstraction 7 | Library (GDAL) compiled with a broad range of drivers. The build process is 8 | based on that defined in the 9 | [GDAL TravisCI tests](https://github.com/OSGeo/gdal/blob/trunk/.travis.yml). 10 | 11 | Each branch in the git repository corresponds to a supported GDAL version 12 | (e.g. `1.11.2`) with the master branch following GDAL master. These branch names 13 | are reflected in the image tags on the Docker Index (e.g. branch `1.11.2` 14 | corresponds to the image `geodata/gdal:1.11.2`). 15 | 16 | ## Usage 17 | 18 | Running the container without any arguments will by default output the GDAL 19 | version string as well as the supported raster and vector formats: 20 | 21 | docker run geodata/gdal 22 | 23 | The following command will open a bash shell in an Ubuntu based environment 24 | with GDAL available: 25 | 26 | docker run -t -i geodata/gdal /bin/bash 27 | 28 | You will most likely want to work with data on the host system from within the 29 | docker container, in which case run the container with the -v option. Assuming 30 | you have a raster called `test.tif` in your current working directory on your 31 | host system, running the following command should invoke `gdalinfo` on 32 | `test.tif`: 33 | 34 | docker run -v $(pwd):/data geodata/gdal gdalinfo test.tif 35 | 36 | This works because the current working directory is set to `/data` in the 37 | container, and you have mapped the current working directory on your host to 38 | `/data`. 39 | 40 | Note that the image tagged `latest`, GDAL represents the latest code *at the 41 | time the image was built*. If you want to include the most up-to-date commits 42 | then you need to build the docker image yourself locally along these lines: 43 | 44 | docker build -t geodata/gdal:local git://github.com/geo-data/gdal-docker/ 45 | -------------------------------------------------------------------------------- /before_install.sh.patch: -------------------------------------------------------------------------------- 1 | --- before_install.sh 2017-10-19 20:46:45.934796715 +0000 2 | +++ before_install.sh 2017-10-19 16:12:20.192772175 +0000 3 | @@ -2,10 +2,10 @@ 4 | 5 | set -e 6 | 7 | -sudo dpkg -l | grep geos 8 | +#sudo dpkg -l | grep geos 9 | sudo apt-get purge -y libgeos* libspatialite* 10 | -find /etc/apt/sources.list.d 11 | -sudo mv /etc/apt/sources.list.d/pgdg* /tmp 12 | +#find /etc/apt/sources.list.d 13 | +#sudo mv /etc/apt/sources.list.d/pgdg* /tmp 14 | #sudo apt-get remove postgis libpq5 libpq-dev postgresql-9.1-postgis postgresql-9.2-postgis postgresql-9.3-postgis postgresql-9.1 postgresql-9.2 postgresql-9.3 libgdal1 15 | #sudo apt-get remove -y postgresql-9.1 16 | sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable 17 | @@ -60,7 +60,7 @@ 18 | unzip c6d36f3db5e4.zip 19 | cd chchrsc-kealib-c6d36f3db5e4/trunk 20 | cmake . -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DHDF5_INCLUDE_DIR=/usr/include -DHDF5_LIB_PATH=/usr/lib -DLIBKEA_WITH_GDAL=OFF 21 | -make -j4 22 | +make -j$(nproc) 23 | sudo make install 24 | cd ../.. 25 | sudo ldconfig 26 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## 4 | # Install GDAL from within a docker container 5 | # 6 | # This script is designed to be run from within a docker container in order to 7 | # install GDAL. It delegates to `before_install.sh` and `install.sh` which are 8 | # patched from the Travis CI configuration in the GDAL repository. 9 | # 10 | 11 | set -e 12 | 13 | DIR=$(dirname "$(readlink -f "$0")") 14 | GDAL_VERSION=$(cat ${DIR}/gdal-checkout.txt) 15 | 16 | export DEBIAN_FRONTEND=noninteractive 17 | 18 | # Set the locale. Required for subversion to work on the repository. 19 | update-locale LANG="C.UTF-8" 20 | dpkg-reconfigure locales 21 | . /etc/default/locale 22 | export LANG 23 | 24 | # Instell prerequisites. 25 | apt-get update -y 26 | apt-get install -y \ 27 | software-properties-common \ 28 | wget \ 29 | unzip \ 30 | subversion \ 31 | ccache \ 32 | clang-3.5 \ 33 | patch \ 34 | python-dev \ 35 | ant 36 | 37 | # Everything happens under here. 38 | cd /tmp 39 | 40 | # Get GDAL. 41 | svn checkout --quiet "http://svn.osgeo.org/gdal/${GDAL_VERSION}/" /tmp/gdal/ 42 | 43 | # Install GDAL. 44 | cd /tmp/gdal 45 | 46 | # Apply our build patches. 47 | patch ./gdal/ci/travis/trusty_clang/before_install.sh ${DIR}/before_install.sh.patch 48 | patch ./gdal/ci/travis/trusty_clang/install.sh ${DIR}/install.sh.patch 49 | 50 | # Do the build. 51 | . ./gdal/ci/travis/trusty_clang/before_install.sh 52 | . ./gdal/ci/travis/trusty_clang/install.sh 53 | 54 | # Clean up. 55 | apt-get autoremove -y 56 | apt-get clean 57 | rm -rf /var/lib/apt/lists/partial/* /tmp/* /var/tmp/* 58 | -------------------------------------------------------------------------------- /gdal-checkout.txt: -------------------------------------------------------------------------------- 1 | trunk 2 | -------------------------------------------------------------------------------- /install.sh.patch: -------------------------------------------------------------------------------- 1 | --- install.sh 2017-10-19 20:46:11.113956620 +0000 2 | +++ install.sh 2017-10-19 20:40:39.850003835 +0000 3 | @@ -17,24 +17,27 @@ 4 | cat /proc/cpuinfo | grep flags | head -n 1 5 | fi 6 | 7 | -CFLAGS=$ARCH_FLAGS CXXFLAGS=$ARCH_FLAGS CC="ccache clang" CXX="ccache clang" LDFLAGS="-lstdc++" ./configure --prefix=/usr --without-libtool --with-jpeg12 --with-python --with-poppler --with-podofo --with-spatialite --with-mysql --with-liblzma --with-webp --with-java --with-mdb --with-jvm-lib-add-rpath --with-epsilon --with-ecw=/usr/local --with-mrsid=/usr/local --with-mrsid-lidar=/usr/local --with-fgdb=/usr/local --with-libkml --with-null 8 | -# --with-gta 9 | +ln -sf /usr/bin/clang-3.5 /usr/bin/clang 10 | +ln -sf /usr/bin/clang++-3.5 /usr/bin/clang++ 11 | + 12 | +CFLAGS=$ARCH_FLAGS CXXFLAGS=$ARCH_FLAGS CC="ccache clang" CXX="ccache clang" LDFLAGS="-lstdc++" ./configure --prefix=/usr --without-libtool --with-jpeg12 --with-python --with-poppler --with-podofo --with-spatialite --with-mysql --with-liblzma --with-webp --with-epsilon --with-ecw=/usr/local --with-mrsid=/usr/local --with-mrsid-lidar=/usr/local --with-fgdb=/usr/local --with-libkml --with-null 13 | +# --with-gta --with-java --with-mdb --with-jvm-lib-add-rpath 14 | # Those ln -s are weird but otherwise Python bindings build fail with clang not being found 15 | -sudo ln -s /usr/local/clang-3.5.0/bin/clang /usr/bin/clang 16 | -sudo ln -s /usr/local/clang-3.5.0/bin/clang++ /usr/bin/clang++ 17 | -make USER_DEFS="-Wextra -Werror" -j3 18 | +#sudo ln -s /usr/local/clang-3.5.0/bin/clang /usr/bin/clang 19 | +#sudo ln -s /usr/local/clang-3.5.0/bin/clang++ /usr/bin/clang++ 20 | +make USER_DEFS="-Wextra -Werror" -j$(nproc) 21 | cd apps 22 | make USER_DEFS="-Wextra -Werror" test_ogrsf 23 | cd .. 24 | 25 | -cd swig/java 26 | -cat java.opt | sed "s/JAVA_HOME =.*/JAVA_HOME = \/usr\/lib\/jvm\/java-8-openjdk-amd64\//" > java.opt.tmp 27 | -mv java.opt.tmp java.opt 28 | -export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 29 | -export PATH=$JAVA_HOME/jre/bin:$PATH 30 | -java -version 31 | -make 32 | -cd ../.. 33 | +#cd swig/java 34 | +#cat java.opt | sed "s/JAVA_HOME =.*/JAVA_HOME = \/usr\/lib\/jvm\/java-8-openjdk-amd64\//" > java.opt.tmp 35 | +#mv java.opt.tmp java.opt 36 | +#export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 37 | +#export PATH=$JAVA_HOME/jre/bin:$PATH 38 | +#java -version 39 | +#make 40 | +#cd ../.. 41 | cd swig/perl 42 | make generate 43 | make 44 | @@ -45,9 +48,9 @@ 45 | sudo ldconfig 46 | 47 | cd fuzzers 48 | -make USER_DEFS="-Wextra -Werror" -j3 49 | +make USER_DEFS="-Wextra -Werror" -j$(nproc) 50 | cd tests 51 | -make USER_DEFS="-Wextra -Werror" -j3 check 52 | +make USER_DEFS="-Wextra -Werror" -j$(nproc) check 53 | cd .. 54 | cd .. 55 | 56 | @@ -55,8 +58,8 @@ 57 | if grep override /usr/include/gdal*.h /usr/include/ogr*.h /usr/include/gnm*.h /usr/include/cpl*.h | grep -v "One can override" | grep -v cpl_port | grep -v "Use this file to override"; then echo "Error: override keyword found in public headers instead of CPL_OVERRIDE" && /bin/false; fi 58 | 59 | cd ../autotest/cpp 60 | -make -j3 61 | +make -j$(nproc) 62 | cd ../../gdal 63 | -wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mdb-sqlite/mdb-sqlite-1.0.2.tar.bz2 64 | -tar xjvf mdb-sqlite-1.0.2.tar.bz2 65 | -sudo cp mdb-sqlite-1.0.2/lib/*.jar /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext 66 | +#wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mdb-sqlite/mdb-sqlite-1.0.2.tar.bz2 67 | +#tar xjvf mdb-sqlite-1.0.2.tar.bz2 68 | +#sudo cp mdb-sqlite-1.0.2/lib/*.jar /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext 69 | --------------------------------------------------------------------------------