postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.35k stars 462 forks source link

Consolidate to fewer templates #299

Open BryanQuigley opened 2 years ago

BryanQuigley commented 2 years ago

I was wondering if there was any interest in generating more of the Docker files from templates at build time? This could make it easier to update, add more archs, or support more versions of PostGIS.

(we were doing something similar here.)

Designing this does somewhat require a better understanding of how many different variations to build/support at a time. This might overlap with @ImreSamu WIP PR where a recommended versions is specified - I really like the idea of a recommended version.

As I see the overall variants right now: OSes: Alpine (1 version at a time). Debian (maybe more than one, right now we have stretch - very unsupported {maybe drop} to support postgis 2.5 and bullseye/stable) Postgres: Clearly says all supported versions, could see the argument for dropping the oldest supported one PostGIS: 3 versions (2.5, 3.2 and master), but it might be helpful to be able to support 3.1/3.3 as well Archs: amd64 (but interest in more)

We could support newer releases with more options - like only arm for 14-3.2, or 14-master.

What would the ideal matrix of variants look like?

ImreSamu commented 2 years ago

Hi BryanQuigley,

we don't have a clear roadmap yet ..

What would the ideal matrix of variants look like?

As I understand - the project has some constraints:

1.) The project ~ have to use the upstream (docker-library/postgres) supported postgres versions:

2.) The Debian postgis packaged versions is very limited ; so no postgis 3.0 , 3.1 ( 3.3 ) package for debians

3.) Long time support for the current users ( ~ debian based images , and if it is easy )

4.) The project's current https://github.com/postgis/docker-postgis/blob/master/update.sh scripts have some limitations

Workarounds for 4.)

now my recommended images based on my: https://github.com/postgis/docker-postgis/pull/295

Debian based:

DockerHub image OS Postgres PostGIS
postgis/postgis:10-2.5 debian:stretch 10 2.5.5
postgis/postgis:10-3.2 debian:bullseye 10 3.2.1
postgis/postgis:11-2.5 debian:stretch 11 2.5.5
postgis/postgis:11-3.2 debian:bullseye 11 3.2.1
postgis/postgis:12-3.2 debian:bullseye 12 3.2.1
postgis/postgis:13-3.2 debian:bullseye 13 3.2.1
postgis/postgis:14-3.2 debian:bullseye 14 3.2.1

not easy to create more variations - with supported base images.

Alpine based: ( now in 3.15 .. )

DockerHub image OS Postgres PostGIS
postgis/postgis:10-2.5-alpine alpine:3.16 10 2.5.5
postgis/postgis:10-3.2-alpine alpine:3.16 10 3.2.1
postgis/postgis:11-2.5-alpine alpine:3.16 11 2.5.5
postgis/postgis:11-3.2-alpine alpine:3.16 11 3.2.1
postgis/postgis:12-3.2-alpine alpine:3.16 12 3.2.1
postgis/postgis:13-3.2-alpine alpine:3.16 13 3.2.1
postgis/postgis:14-3.2-alpine alpine:3.16 14 3.2.1

Test images ( planned )

DockerHub image OS Postgres PostGIS
postgis/postgis:13-master debian:bullseye 13 development: postgis, geos, proj, gdal
postgis/postgis:14-3.3.0alpha1-alpine alpine:3.16 14 3.3.0alpha1
postgis/postgis:14-master debian:bullseye 14 development: postgis, geos, proj, gdal
postgis/postgis:15beta1-3.3.0alpha1-alpine alpine:3.16 15beta1 3.3.0alpha1
postgis/postgis:15beta1-master debian:bullseye 15beta1 development: postgis, geos, proj, gdal

My opinion:

And Later we can add multiple alpine images:

etc ..

I was wondering if there was any interest in generating more of the Docker files from templates at build time? This could make it easier to update, add more archs, or support more versions of PostGIS.

I do not fully understand your proposal, can you give me a simple example?

honestly I prefer recommendations that are compatible with the upstream ( docker-library/postgres ) best practices ( + jq templating ) see the current version docker-library/postgres repo,
that I would like to target :

and the upstream repo is pre-generating Dockerfiles

arm for 14-master.

it has a very long build time ( X86-64 ~ 30-40 min ) so without a strong hardware CI support - I don't recommend in the first iteration.

BryanQuigley commented 2 years ago

Thanks for the detailed response!

2.) Understood. Postgis 3.1 is packaged with Postgres 13 in the stock Debian repos, but that might be to divergent to try using. 3.) I forgot Stretch has LTS - although it is ending in 15 days (https://wiki.debian.org/LTS) 4.) Missed those limitations

jq templating seems similar - but maybe better than what I was proposing.. Will investigate it more. Happy to help however I can be useful - if that's the jq bit, sure :).

phillipross commented 2 years ago

In the limited time I've had to think about some of these things, I thought that maybe it could be helpful to start working on a newer build framework in parallel to the one that exists now.

The limitations we've had thus far have been constraining things for too long. The constraints have been accepted/tolerated mostly to prevent breaking compatibility for the existing user base. Maybe a new framework could be established in parallel to develop/modernize things? Traditionally we modeled things after the docker-library postgresql repo in hopes of some day becoming the definitive top-level postgis image, but the postgresql repo has since evolved to use jq to parse richer build metadata for configurations.

Maybe a separate branch needs to be created and development started on an updated framework? Github actions supports multiple workflow configurations. We could start development to modernize things without breaking compatibility for existing users, pushing images to dockerhub with different tag naming schemes, and making them available for the community to test with?

BryanQuigley commented 2 years ago

It looks like the jq parser in postgres may be refactored once stretch is EOL (end of this month), will approach doing something then. I think it should be quite possible to refactor and maintain the existing images (once stretch is gone).