From ce4dc7369b2d541b5e76a2b3900cb71ff93ff957 Mon Sep 17 00:00:00 2001 From: Marcos Gabarda Date: Mon, 8 Dec 2025 13:03:04 +0100 Subject: [PATCH] chore: updated to use generic Dockerfile --- Makefile | 50 +++++++++++++++++++++++---------------- postgis/11-2.5/Dockerfile | 6 ----- postgis/12-3.0/Dockerfile | 6 ----- postgis/13-3.1/Dockerfile | 6 ----- postgis/14-3.4/Dockerfile | 6 ----- postgis/15-3.4/Dockerfile | 6 ----- postgis/16-3.4/Dockerfile | 6 ----- postgis/Dockerfile | 12 ++++++++++ postgres/10/Dockerfile | 6 ----- postgres/11/Dockerfile | 6 ----- postgres/12/Dockerfile | 6 ----- postgres/13/Dockerfile | 6 ----- postgres/14/Dockerfile | 6 ----- postgres/15/Dockerfile | 6 ----- postgres/16/Dockerfile | 6 ----- postgres/Dockerfile | 14 +++++++++++ 16 files changed, 55 insertions(+), 99 deletions(-) delete mode 100644 postgis/11-2.5/Dockerfile delete mode 100644 postgis/12-3.0/Dockerfile delete mode 100644 postgis/13-3.1/Dockerfile delete mode 100644 postgis/14-3.4/Dockerfile delete mode 100644 postgis/15-3.4/Dockerfile delete mode 100644 postgis/16-3.4/Dockerfile create mode 100644 postgis/Dockerfile delete mode 100644 postgres/10/Dockerfile delete mode 100644 postgres/11/Dockerfile delete mode 100644 postgres/12/Dockerfile delete mode 100644 postgres/13/Dockerfile delete mode 100644 postgres/14/Dockerfile delete mode 100644 postgres/15/Dockerfile delete mode 100644 postgres/16/Dockerfile create mode 100644 postgres/Dockerfile diff --git a/Makefile b/Makefile index 87c8a63..50292d2 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,49 @@ # Variables # ------------------------------------------------------------------------------ -POSTGRES_IMAGE_ID := marcosgabarda/postgres -POSTGIS_IMAGE_ID := marcosgabarda/postgis +POSTGRES_IMAGE_ID := quay.io/marcosgabarda/postgres +POSTGIS_IMAGE_ID := quay.io/marcosgabarda/postgis # Versions to build # ------------------------------------------------------------------------------ -POSTGRES_VERSIONS := 10 11 12 13 14 15 -POSTGRES_LATEST_VERSION := 16 -POSTGIS_VERSIONS := 11-2.5 12-3.0 13-3.1 14-3.4 15-3.4 -POSTGIS_LATEST_VERSION := 16-3.4 +POSTGRES_VERSIONS := 12 13 14 15 16 17 +POSTGRES_LATEST_VERSION := 18 +POSTGIS_VERSIONS := 12-3.0 13-3.1 14-3.4 15-3.4 16-3.5 17-3.6 +POSTGIS_LATEST_VERSION := 18-3.6 -.PHONY: build_postgres push_postgres build_postgis push_postgis build push +# Docker command +# ------------------------------------------------------------------------------ +DOCKER := podman + +.PHONY: build-postgres push-postgres build-postgis push-postgis build push -build_postgres: +build-postgres: @for version in $(POSTGRES_VERSIONS) ; do \ - docker buildx build . -f ./postgres/$$version/Dockerfile --tag ${POSTGRES_IMAGE_ID}:$$version --platform linux/amd64,linux/arm64 ; \ + ${DOCKER} build . -f ./postgres/Dockerfile --tag ${POSTGRES_IMAGE_ID}:$$version --build-arg POSTGRES_VERSION=$$version --platform linux/amd64 ; \ done - docker buildx build . -f ./postgres/${POSTGRES_LATEST_VERSION}/Dockerfile --tag ${POSTGRES_IMAGE_ID}:${POSTGRES_LATEST_VERSION} --tag ${POSTGRES_IMAGE_ID}:latest --platform linux/amd64,linux/arm64 + ${DOCKER} build . -f ./postgres/Dockerfile --tag ${POSTGRES_IMAGE_ID}:${POSTGRES_LATEST_VERSION} --tag ${POSTGRES_IMAGE_ID}:latest --build-arg POSTGRES_VERSION=${POSTGRES_LATEST_VERSION} --platform linux/amd64 -push_postgres: +push-postgres: build-postgres @for version in $(POSTGRES_VERSIONS) ; do \ - docker buildx build . -f ./postgres/$$version/Dockerfile --tag ${POSTGRES_IMAGE_ID}:$$version --platform linux/amd64,linux/arm64 --push ; \ + ${DOCKER} push ${POSTGRES_IMAGE_ID}:$$version ; \ done - docker buildx build . -f ./postgres/${POSTGRES_LATEST_VERSION}/Dockerfile --tag ${POSTGRES_IMAGE_ID}:${POSTGRES_LATEST_VERSION} --tag ${POSTGRES_IMAGE_ID}:latest --platform linux/amd64,linux/arm64 --push + ${DOCKER} push ${POSTGRES_IMAGE_ID}:${POSTGRES_LATEST_VERSION} + ${DOCKER} push ${POSTGRES_IMAGE_ID}:latest -build_postgis: +build-postgis: @for version in $(POSTGIS_VERSIONS) ; do \ - docker buildx build . -f ./postgis/$$version/Dockerfile --tag ${POSTGIS_IMAGE_ID}:$$version --tag ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,$$version)) --platform linux/amd64,linux/arm64 ; \ + ${DOCKER} build . -f ./postgis/Dockerfile --tag ${POSTGIS_IMAGE_ID}:$$version --tag ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,$$version)) --build-arg POSTGIS_VERSION=$$version --platform linux/amd64 ; \ done - docker buildx build . -f ./postgis/${POSTGIS_LATEST_VERSION}/Dockerfile --tag ${POSTGIS_IMAGE_ID}:${POSTGIS_LATEST_VERSION} --tag ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,$(POSTGIS_LATEST_VERSION))) --tag ${POSTGIS_IMAGE_ID}:latest --platform linux/amd64,linux/arm64 + ${DOCKER} build . -f ./postgis/Dockerfile --tag ${POSTGIS_IMAGE_ID}:${POSTGIS_LATEST_VERSION} --tag ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,$(POSTGIS_LATEST_VERSION))) --tag ${POSTGIS_IMAGE_ID}:latest --build-arg POSTGIS_VERSION=${POSTGIS_LATEST_VERSION} --platform linux/amd64 -push_postgis: +push-postgis: build-postgis @for version in $(POSTGIS_VERSIONS) ; do \ - docker buildx build . -f ./postgis/$$version/Dockerfile --tag ${POSTGIS_IMAGE_ID}:$$version --tag ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,$$version)) --platform linux/amd64,linux/arm64 --push ; \ + ${DOCKER} push ${POSTGIS_IMAGE_ID}:$$version ; \ + ${DOCKER} push ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,$$version)); \ done - docker buildx build . -f ./postgis/${POSTGIS_LATEST_VERSION}/Dockerfile --tag ${POSTGIS_IMAGE_ID}:${POSTGIS_LATEST_VERSION} --tag ${POSTGIS_IMAGE_ID}:14 --tag ${POSTGIS_IMAGE_ID}:latest --platform linux/amd64,linux/arm64 --push + ${DOCKER} push ${POSTGIS_IMAGE_ID}:${POSTGIS_LATEST_VERSION} + ${DOCKER} push ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,${POSTGIS_LATEST_VERSION})) + ${DOCKER} push ${POSTGIS_IMAGE_ID}:latest -build: build_postgres build_postgis +build: build-postgres build-postgis -push: push_postgres push_postgis +push: push-postgres push-postgis diff --git a/postgis/11-2.5/Dockerfile b/postgis/11-2.5/Dockerfile deleted file mode 100644 index 025b8c4..0000000 --- a/postgis/11-2.5/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgis/postgis:11-2.5-alpine - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgis/12-3.0/Dockerfile b/postgis/12-3.0/Dockerfile deleted file mode 100644 index bbfe227..0000000 --- a/postgis/12-3.0/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgis/postgis:12-3.0-alpine - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgis/13-3.1/Dockerfile b/postgis/13-3.1/Dockerfile deleted file mode 100644 index 0e62a9f..0000000 --- a/postgis/13-3.1/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgis/postgis:13-3.1-alpine - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgis/14-3.4/Dockerfile b/postgis/14-3.4/Dockerfile deleted file mode 100644 index d95afc1..0000000 --- a/postgis/14-3.4/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgis/postgis:14-3.4-alpine - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgis/15-3.4/Dockerfile b/postgis/15-3.4/Dockerfile deleted file mode 100644 index 79cdaac..0000000 --- a/postgis/15-3.4/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgis/postgis:15-3.4-alpine - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgis/16-3.4/Dockerfile b/postgis/16-3.4/Dockerfile deleted file mode 100644 index 28e7b49..0000000 --- a/postgis/16-3.4/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgis/postgis:16-3.4-alpine - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgis/Dockerfile b/postgis/Dockerfile new file mode 100644 index 0000000..57c1748 --- /dev/null +++ b/postgis/Dockerfile @@ -0,0 +1,12 @@ +# parametrize docker image and tag +# ------------------------------------------------------------------------------ +ARG POSTGIS_IMAGE=docker.io/postgis/postgis +ARG POSTGIS_VERSION=16-3.4 +FROM ${POSTGIS_IMAGE}:${POSTGIS_VERSION}-alpine + +# copy maintenance scripts +# ------------------------------------------------------------------------------ +COPY ./maintenance /usr/local/bin/maintenance +RUN chmod +x /usr/local/bin/maintenance/* +RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ + && rmdir /usr/local/bin/maintenance diff --git a/postgres/10/Dockerfile b/postgres/10/Dockerfile deleted file mode 100644 index c4bdca0..0000000 --- a/postgres/10/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgres:10 - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgres/11/Dockerfile b/postgres/11/Dockerfile deleted file mode 100644 index 5e4834a..0000000 --- a/postgres/11/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgres:11 - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgres/12/Dockerfile b/postgres/12/Dockerfile deleted file mode 100644 index b63892b..0000000 --- a/postgres/12/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgres:12 - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgres/13/Dockerfile b/postgres/13/Dockerfile deleted file mode 100644 index 3ab7ce3..0000000 --- a/postgres/13/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgres:13 - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgres/14/Dockerfile b/postgres/14/Dockerfile deleted file mode 100644 index b8f9080..0000000 --- a/postgres/14/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgres:14 - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgres/15/Dockerfile b/postgres/15/Dockerfile deleted file mode 100644 index 7c9dec5..0000000 --- a/postgres/15/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgres:15 - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgres/16/Dockerfile b/postgres/16/Dockerfile deleted file mode 100644 index d8ade08..0000000 --- a/postgres/16/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM postgres:16 - -COPY ./maintenance /usr/local/bin/maintenance -RUN chmod +x /usr/local/bin/maintenance/* -RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ - && rmdir /usr/local/bin/maintenance diff --git a/postgres/Dockerfile b/postgres/Dockerfile new file mode 100644 index 0000000..ac867a5 --- /dev/null +++ b/postgres/Dockerfile @@ -0,0 +1,14 @@ +# parametrize docker image and tag +# ------------------------------------------------------------------------------ +ARG POSTGRES_IMAGE=docker.io/postgres +ARG POSTGRES_VERSION=16 + +FROM ${POSTGRES_IMAGE}:${POSTGRES_VERSION} + +# copy maintenance scripts +# ------------------------------------------------------------------------------ + +COPY ./maintenance /usr/local/bin/maintenance +RUN chmod +x /usr/local/bin/maintenance/* +RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ + && rmdir /usr/local/bin/maintenance -- 2.51.2