├── .travis.yml ├── Dockerfile ├── LICENSE ├── Makefile └── README.md /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | 3 | sudo: false 4 | 5 | services: 6 | - docker 7 | 8 | install: 9 | - make image 10 | 11 | script: 12 | - make test 13 | - make lint 14 | 15 | after_success: 16 | - if [[ "$TRAVIS_BRANCH" == "master" ]]; then 17 | docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD ; 18 | make push-image ; 19 | fi 20 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | # andrejreznik/python-gdal 3 | # 4 | # Official Python 3.7.3 image based on slim Debian 9.8 Stretch image. 5 | FROM python:3.7-slim-stretch 6 | 7 | LABEL maintainer="Andrey Reznik " 8 | 9 | ENV GDAL_VERSION=2.4.1 \ 10 | SOURCE_DIR="/usr/local/src/python-gdal" 11 | 12 | RUN \ 13 | # Install runtime dependencies 14 | apt-get update \ 15 | && apt-get install -y --no-install-recommends \ 16 | build-essential \ 17 | wget \ 18 | libpq-dev \ 19 | libcurl4-gnutls-dev \ 20 | libproj-dev \ 21 | libxml2-dev \ 22 | libgeos-dev \ 23 | libnetcdf-dev \ 24 | libpoppler-dev \ 25 | libspatialite-dev \ 26 | libhdf4-alt-dev \ 27 | libhdf5-serial-dev \ 28 | libopenjp2-7-dev \ 29 | && rm -rf /var/lib/apt/lists/* \ 30 | \ 31 | # Get latest GDAL source 32 | && mkdir -p "${SOURCE_DIR}" \ 33 | && cd "${SOURCE_DIR}" \ 34 | && wget "http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz" \ 35 | && tar -xvf "gdal-${GDAL_VERSION}.tar.gz" \ 36 | \ 37 | # Compile and install GDAL 38 | && cd "gdal-${GDAL_VERSION}" \ 39 | && ./configure \ 40 | --with-python \ 41 | --with-curl \ 42 | --with-openjpeg \ 43 | && make -j"$(nproc)" \ 44 | && make install \ 45 | && ldconfig \ 46 | \ 47 | # Install Python bindings 48 | && cd "${SOURCE_DIR}/gdal-${GDAL_VERSION}/swig/python" \ 49 | && python3 setup.py build \ 50 | && python3 setup.py install \ 51 | && cd /usr/local \ 52 | \ 53 | # Clean up 54 | && apt-get update -y \ 55 | && apt-get remove -y --purge build-essential wget \ 56 | && apt-get autoremove -y \ 57 | && rm -rf /var/lib/apt/lists/* \ 58 | && rm -rf "${SOURCE_DIR}" 59 | 60 | CMD python3 -V && pip -V && gdalinfo --version 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Andrey Reznik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | IMAGE := andrejreznik/python-gdal:stable 2 | 3 | image: 4 | docker build -t $(IMAGE) . 5 | 6 | test: 7 | docker run $(IMAGE) 8 | 9 | lint: 10 | docker run -v `pwd`/Dockerfile:/Dockerfile replicated/dockerfilelint /Dockerfile 11 | 12 | push-image: 13 | docker push $(IMAGE) 14 | 15 | .PHONY: image test lint push-image 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # :whale: python-gdal 2 | [![Build Status](https://travis-ci.org/andrejreznik/docker-python-gdal.svg?branch=master)](https://travis-ci.org/andrejreznik/docker-python-gdal)![](https://images.microbadger.com/badges/image/andrejreznik/python-gdal.svg)![](https://img.shields.io/docker/pulls/andrejreznik/python-gdal.svg) 3 | 4 | #### Python + GDAL/OGR Docker image 5 | 6 | Get and compile latest stable GDAL/OGR sources from official repository. 7 | 8 | #### Usage 9 | 10 | Output versions of Python, pip and GDAL 11 | 12 | ```bash 13 | $ docker run andrejreznik/python-gdal:stable 14 | 15 | Python 3.7.3 16 | pip 19.0.3 from /usr/local/lib/python3.7/site-packages/pip (python 3.7) 17 | GDAL 2.4.1, released 2019/03/15 18 | ``` 19 | 20 | Run container and start an interactive bash session as root 21 | 22 | ```bash 23 | $ docker run -it andrejreznik/python-gdal:stable bash 24 | ``` 25 | --------------------------------------------------------------------------------