You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the latest image is ~1.5GB containing numerous optional dependencies. It would be valuable to offer various images based on different deployment profiles/environments.
determine images to produce (e.g. slim, default, full)
I have started using Pygeoapi recently and I am interested in trying to reduce the image size and resource requirements for cheaper cloud deployments and improved security.
Everything is self-contained under docker-proposals/; the current Dockerfile is untouched, so nothing in the repo changes until we agree on a direction.
All five build and serve. This also resolves #2221 (pure pip no gunicorn/gevent mismatch) and #2180 (geopandas in standard/full).
To test:
git clone -b docker-variants https://github.com/terraops-org/pygeoapi.git
cd pygeoapi
docker build -f docker-proposals/Dockerfile.slim -t pygeoapi:slim .
docker run -p 5000:80 pygeoapi:slim
# tge same pattern for Dockerfile.alpine / .distroless / .standard / .full
My comments. I support the idea of multiple Docker images. I would follow another approach. At least with more unification and common conventions. And maybe start with two variants and build, like slim and full and work from there on possibly intermediate variants. My feeling is that the above approach has drawbacks:
variation in base images and install commands
use of a mix of Debian and PyPi packages and custom compiles
a GDAL Base image is handy, but may give other complexities (versions etc) and the size gain may be small
these days the Ubuntu Docker Image already very small, 75-80 MB uncompressed
all these different environments need their own security patching
IMHO the above approach will make maintenance quite hard. The mix of Debian, Ubuntu-GIS and PyPi packages and custom compiles has felt always awkward to me, at the time I did not know better..., unless we could rely completely on one repo like Debian.
How I would approach this? BTW Appreciating the work @jorgejesus has already done!
I just spent quite some time on GeoHealthCheck cleaning. The main approach that helped me was to first standardize package management:
from a bunch of requirements.txt files standardized to pyproject.toml also part of the Python standard (IMHO)
introduced Pixi (thanks @francbartoli !) as Python Environment manager
all dependencies, inclding binary, multiple environments within a single .pixi directory no more system-wide "Proj" libs
slimmed the Dockerfile with a Pixi multi-stage build, copy-ing even all binary dependencies
Pixi is not even needed at runtime in Dockerfile
The main asset here is that Pixi is built on top of Conda and uv and uses both the PyPi and Conda Channels. Blazing fast as well.
(Though I never tested with GDAL, but many Data Science folks use Conda and Mamba family.)
The whole bunch is now much better maintainable, but also for local testing, even linestepping within Pycharm and once even connecting to Docker Container. Version management in one place, warnings when misaligning versions.
Long story. But the whole approach has just two main files and a README, see these GeoHealthCheck files:
I would first start with Pixi (or maybe one from the Conda family), streamline the whole dep management, redesign the current Dockerfile and then split into the Slim, Full etc.
This is quite some effort, I probably spent days, also as the whole Pixi-Conda thing was new for me (never too old to learn!). But am very happy I did!
I think the general principle is that Python packages are not derived from Ubuntu system dependencies. The next question centres around.
@jorgejesus any details on using osgeo/gdal as the base image for standard/full images (vs. UbuntuGIS PPA'ing them)? So this would mean similar to the slim option, adding GDAL/etc. via UbuntuGIS.
Just tested Pixi with GDAL (as GDAL is no dep in GHC) but added as test temporary. By default Pixi will use system GDAL (when added to dependencies) which has to match version, but it is also possible to get GDAL as a Conda package within the Pixi .pixi/ env-bundle. This added around 150MB to the .pixi libs. Within Docker about 250MB uncompressed. A full GDAL I expect. The latter number is more reliable, as maybe are system-deps (GEOS?) may have been used.
To use GDAL from Conda channel: pixi add GDAL, then it is added at the right places in pyproject.toml.
Edit: using GDAL Base image could still be a good option! I am staying away a bit from Alpine, unless using self-contained Image like PostGIS.
My comments. I support the idea of multiple Docker images. I would follow another approach. At least with more unification and common conventions. And maybe start with two variants and build, like slim and full and work from there on possibly intermediate variants. My feeling is that the above approach has drawbacks:
variation in base images and install commands
use of a mix of Debian and PyPi packages and custom compiles
a GDAL Base image is handy, but may give other complexities (versions etc) and the size gain may be small
these days the Ubuntu Docker Image already very small, 75-80 MB uncompressed
all these different environments need their own security patching
IMHO the above approach will make maintenance quite hard. The mix of Debian, Ubuntu-GIS and PyPi packages and custom compiles has felt always awkward to me, at the time I did not know better..., unless we could rely completely on one repo like Debian.
How I would approach this? BTW Appreciating the work @jorgejesus has already done!
I just spent quite some time on GeoHealthCheck cleaning. The main approach that helped me was to first standardize package management:
from a bunch of requirements.txt files standardized to pyproject.toml also part of the Python standard (IMHO)
introduced Pixi (thanks @francbartoli !) as Python Environment manager
all dependencies, inclding binary, multiple environments within a single .pixi directory no more system-wide "Proj" libs
slimmed the Dockerfile with a Pixi multi-stage build, copy-ing even all binary dependencies
Pixi is not even needed at runtime in Dockerfile
The main asset here is that Pixi is built on top of Conda and uv and uses both the PyPi and Conda Channels. Blazing fast as well. (Though I never tested with GDAL, but many Data Science folks use Conda and Mamba family.)
The whole bunch is now much better maintainable, but also for local testing, even linestepping within Pycharm and once even connecting to Docker Container. Version management in one place, warnings when misaligning versions.
Long story. But the whole approach has just two main files and a README, see these GeoHealthCheck files:
I would first start with Pixi (or maybe one from the Conda family), streamline the whole dep management, redesign the current Dockerfile and then split into the Slim, Full etc.
This is quite some effort, I probably spent days, also as the whole Pixi-Conda thing was new for me (never too old to learn!). But am very happy I did!
I'm totally supportive of this direction, I wrote almost all the migration to pixi of GHC with the experience done during OGC sprint in Nov 2025. I paste here an example of a minimal pixi.toml for GDAL binaries coming from different channels, the dev one is the conda channel from GDAL nightly builds. Hope it is useful to figure out the grade of freedom that pixi would open for developers and maintainers.
# pixi.toml
[workspace]
authors = ["Francesco Bartoli <xbartolone@gmail.com>"]
# conda-forge only at workspace level: it is the default channel# for every environment that does not override itchannels = ["conda-forge"]
name = "pygeoapi"# Multi-platform guarantee: pixi solves and locks every environment# for all the platforms listed here, so pixi.lock is reproducible on# Apple Silicon, Intel macOS, Linux (x86_64/ARM) and Windows alikeplatforms = ["osx-arm64", "osx-64", "linux-64", "linux-aarch64", "win-64"]
version = "0.1.0"# ---------------------------------------------------------------# Dependencies and tasks shared by all environments# ---------------------------------------------------------------
[dependencies]
python = ">=3.14"
[tasks]
gdal-version = "python -c \"from osgeo import gdal; print('GDAL version:', gdal.__version__)\""# ---------------------------------------------------------------# Feature "main": stable runtime, conda-forge only, GDAL 3.x# ---------------------------------------------------------------
[feature.main.dependencies]
gdal = "<4"libgdal-core = "<4"# ---------------------------------------------------------------# Feature "dev": development of embryonic features against GDAL# builds coming from the gdal-master channel (nightly/master)# ---------------------------------------------------------------
[feature.dev]
# priority = 1 > 0 (default for workspace channels), so in this# environment gdal-master wins over conda-forge for the packages# it publisheschannels = [{ channel = "gdal-master", priority = 1 }]
[feature.dev.dependencies]
# No upper bound: we want the development builds (e.g. 4.0.0devYYYYMMDD)gdal = "*"libgdal-core = "*"ipython = ">=9.6.0,<10"
[feature.dev.tasks]
shell = "ipython"# ---------------------------------------------------------------# Environments# ---------------------------------------------------------------
[environments]
default = { features = ["main"], solve-group = "main" }
dev = { features = ["dev"] }
Activity
github-actions commentedon Oct 27, 2024
This Issue has been inactive for 90 days. As per RFC4, in order to manage maintenance burden, it will be automatically closed in 7 days.
kalxas commentedon Oct 27, 2024
I have been experimenting with a slim version of our Docker image. I agree it would be good to have different images for different use cases.
mattdear commentedon Mar 7, 2025
I have started using Pygeoapi recently and I am interested in trying to reduce the image size and resource requirements for cheaper cloud deployments and improved security.
I was thinking about trying to build the pygeoapi image with the Ubuntu/python base. https://hub.docker.com/r/ubuntu/python
@kalxas can I ask what base images you have tried? And how successful you have been?
mikebelanger commentedon Apr 15, 2025
I'd be interested in what you've found too @kalxas.
27 remaining items
webb-ben commentedon Jul 9, 2026
Were there any conclusions from the pygeoapi Docker survey? https://lists.osgeo.org/pipermail/pygeoapi/2026-February/000481.html
tomkralidis commentedon Jul 9, 2026
The proposal is that Python packages are not derived from Ubuntu system dependencies. We'll have the work in a PR once the next release is complete.
jorgejesus commentedon Jul 22, 2026
First comment: Issue #2392 is a blocker of the new docker implementations
To test current docker proposals:
Everything is self-contained under
docker-proposals/; the current Dockerfile is untouched, so nothing in the repo changes until we agree on a direction.All five build and serve. This also resolves #2221 (pure pip no gunicorn/gevent mismatch) and #2180 (geopandas in standard/full).
To test:
These are my resilts
ubuntu:26.04LTSdistroless/python3-debian13osgeo/gdal:ubuntu-small-3.12.4osgeo/gdal:ubuntu-small-3.12.4python:alpinejustb4 commentedon Jul 22, 2026
My comments. I support the idea of multiple Docker images. I would follow another approach. At least with more unification and common conventions. And maybe start with two variants and build, like slim and full and work from there on possibly intermediate variants. My feeling is that the above approach has drawbacks:
IMHO the above approach will make maintenance quite hard. The mix of Debian, Ubuntu-GIS and PyPi packages and custom compiles has felt always awkward to me, at the time I did not know better..., unless we could rely completely on one repo like Debian.
Our (pygeoapi's) main problem is that we need Python and non-Python (like GDAL) dependencies. Most Python environment managers like
venv,pyenvand evenuvcannot deal with non-Python dependencies, or take the "wheel-route".I shared this document several times, but for me was en eye-opener:
https://www.nijho.lt/post/python-environments/ and subsequently:
https://codecookcash.substack.com/p/simplifying-dependency-management
How I would approach this? BTW Appreciating the work @jorgejesus has already done!
I just spent quite some time on GeoHealthCheck cleaning. The main approach that helped me was to first standardize package management:
pyproject.tomlalso part of the Python standard (IMHO)Pixi(thanks @francbartoli !) as Python Environment manager.pixidirectory no more system-wide "Proj" libsPixiis not even needed at runtime in DockerfileThe main asset here is that Pixi is built on top of Conda and
uvand uses both the PyPi and Conda Channels. Blazing fast as well.(Though I never tested with GDAL, but many Data Science folks use Conda and Mamba family.)
The whole bunch is now much better maintainable, but also for local testing, even linestepping within Pycharm and once even connecting to Docker Container. Version management in one place, warnings when misaligning versions.
Long story. But the whole approach has just two main files and a README, see these GeoHealthCheck files:
I would first start with Pixi (or maybe one from the Conda family), streamline the whole dep management, redesign the current Dockerfile and then split into the Slim, Full etc.
This is quite some effort, I probably spent days, also as the whole Pixi-Conda thing was new for me (never too old to learn!). But am very happy I did!
tomkralidis commentedon Jul 22, 2026
I think the general principle is that Python packages are not derived from Ubuntu system dependencies. The next question centres around.
@jorgejesus any details on using osgeo/gdal as the base image for standard/full images (vs. UbuntuGIS PPA'ing them)? So this would mean similar to the slim option, adding GDAL/etc. via UbuntuGIS.
justb4 commentedon Jul 22, 2026
Just tested Pixi with GDAL (as GDAL is no dep in GHC) but added as test temporary. By default Pixi will use system GDAL (when added to
dependencies) which has to match version, but it is also possible to get GDAL as a Conda package within the Pixi.pixi/env-bundle. This added around 150MB to the .pixi libs. Within Docker about 250MB uncompressed. A full GDAL I expect. The latter number is more reliable, as maybe are system-deps (GEOS?) may have been used.To use GDAL from Conda channel:
pixi add GDAL, then it is added at the right places inpyproject.toml.Edit: using GDAL Base image could still be a good option! I am staying away a bit from Alpine, unless using self-contained Image like PostGIS.
francbartoli commentedon Jul 23, 2026
I'm totally supportive of this direction, I wrote almost all the migration to pixi of GHC with the experience done during OGC sprint in Nov 2025. I paste here an example of a minimal
pixi.tomlfor GDAL binaries coming from different channels, thedevone is the conda channel from GDAL nightly builds. Hope it is useful to figure out the grade of freedom that pixi would open for developers and maintainers.github-actions commentedon Oct 25, 2026
This Issue has been inactive for 90 days. As per RFC4, in order to manage maintenance burden, it will be automatically closed in 7 days.