opendatacube/geobase-builder

Sponsored OSS

By opendatacube

Updated over 4 years ago

Docker for building geospatial python virtual environments on Ubuntu 20.04

Image
Languages & frameworks
Integration & delivery
Data science
1

50K+

opendatacube/geobase-builder repository overview

opendatacube/geobase-{builder|runner}

Set of docker images to build recent versions of geospatial libraries and python environments that use them.

  • GEOS 3.8.0 (from apt)
  • PROJ 7.2.1 (compiled)
  • KEA 1.4.14 (compiled)
  • LERC 2.2.1 (compiled)
  • GDAL 3.3.0 (compiled)

Quick Start

  1. Create requirements.txt and constraints.txt (could be empty)
rasterio[s3]
pyproj
  1. Create Dockerfile
FROM opendatacube/geobase-builder as env_builder
COPY requirements.txt /
COPY constraints.txt /
RUN env-build-tool new /requirements.txt /constraints.txt /env


FROM opendatacube/geobase-runner
COPY --from=env_builder /env /env
ENV LC_ALL=C.UTF-8
ENV PATH="/env/bin:${PATH}"

See sample directory for more information.

Overview

Basic idea is to use multi-stage builds to minimize output docker image size and to reduce surface area for security/deployment concerns.

Each step is described in more detail below. Overall structure is as following

  1. Build C/C++ libs for PROJ,LERC,KEA,GDAL in base/builder, package those in .deb
  2. Include run-time libs needed by libs built in stages 1 and 2 in base/runner
  3. Use multi-stage building technique to construct docker image with customized python environment that suits your needs:
    • Base builder stage on opendatacube/geobase-builder:${V_BASE}
    • Install any extra missing dev libs you need via apt-get
    • Construct python environment taking care to use pre-compiled wheels where possible
    • Base runner stage on opendatacube/geobase-runner:${V_BASE}
    • Install any extra C/C++ run time libs via apt-get
    • Copy the entire python environment across from builder stage

base/builder

  • Based on buildack-deps:focal (Ubuntu 20.04)
  • Builds LERC, KEA and GDAL from source
  • Contains lots of dev libs to enable compilation of common python modules that call out to C/C++
  • Least changing layer

Folder structure:

  • base/builder/Dockerfile base builder image: docker pull opendatacube/geobase-builder
    • /dl/ contains downloaded sources
    • /opt/ contains built .deb for gdal/kea/proj/lerc
  • base/builder/gdal.opts feature selection for compiled GDAL, removing features should be easy, adding might require installing extra build dependencies with apt-get, might also need to add those extra libs to base/runner/Dockerfile.

base/runner

Derives from ubuntu:20.04, has all the necessary C/C++/Fortran libs installed in non-dev mode to run python wheels compiled in base/builder.

It is used as base for "runner dockers" that use multi-stage building technique: builder stage constructs a python environment using pre-compiled wheels + whatever extra downloaded from pypi.

Tag summary

Content type

Image

Digest

Size

467.8 MB

Last updated

over 4 years ago

docker pull opendatacube/geobase-builder:3.3.0

This week's pulls

Pulls:

12

Jun 29 to Jul 5