Docker images for postgres extended with management bash scripts.

chore: updated to use generic Dockerfile

+55 -99
+29 -21
Makefile
··· 1 1 # Variables 2 2 # ------------------------------------------------------------------------------ 3 - POSTGRES_IMAGE_ID := marcosgabarda/postgres 4 - POSTGIS_IMAGE_ID := marcosgabarda/postgis 3 + POSTGRES_IMAGE_ID := quay.io/marcosgabarda/postgres 4 + POSTGIS_IMAGE_ID := quay.io/marcosgabarda/postgis 5 5 6 6 # Versions to build 7 7 # ------------------------------------------------------------------------------ 8 - POSTGRES_VERSIONS := 10 11 12 13 14 15 9 - POSTGRES_LATEST_VERSION := 16 10 - POSTGIS_VERSIONS := 11-2.5 12-3.0 13-3.1 14-3.4 15-3.4 11 - POSTGIS_LATEST_VERSION := 16-3.4 8 + POSTGRES_VERSIONS := 12 13 14 15 16 17 9 + POSTGRES_LATEST_VERSION := 18 10 + POSTGIS_VERSIONS := 12-3.0 13-3.1 14-3.4 15-3.4 16-3.5 17-3.6 11 + POSTGIS_LATEST_VERSION := 18-3.6 12 + 13 + # Docker command 14 + # ------------------------------------------------------------------------------ 15 + DOCKER := podman 12 16 13 - .PHONY: build_postgres push_postgres build_postgis push_postgis build push 17 + .PHONY: build-postgres push-postgres build-postgis push-postgis build push 14 18 15 - build_postgres: 19 + build-postgres: 16 20 @for version in $(POSTGRES_VERSIONS) ; do \ 17 - docker buildx build . -f ./postgres/$$version/Dockerfile --tag ${POSTGRES_IMAGE_ID}:$$version --platform linux/amd64,linux/arm64 ; \ 21 + ${DOCKER} build . -f ./postgres/Dockerfile --tag ${POSTGRES_IMAGE_ID}:$$version --build-arg POSTGRES_VERSION=$$version --platform linux/amd64 ; \ 18 22 done 19 - 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 23 + ${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 20 24 21 - push_postgres: 25 + push-postgres: build-postgres 22 26 @for version in $(POSTGRES_VERSIONS) ; do \ 23 - docker buildx build . -f ./postgres/$$version/Dockerfile --tag ${POSTGRES_IMAGE_ID}:$$version --platform linux/amd64,linux/arm64 --push ; \ 27 + ${DOCKER} push ${POSTGRES_IMAGE_ID}:$$version ; \ 24 28 done 25 - 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 29 + ${DOCKER} push ${POSTGRES_IMAGE_ID}:${POSTGRES_LATEST_VERSION} 30 + ${DOCKER} push ${POSTGRES_IMAGE_ID}:latest 26 31 27 - build_postgis: 32 + build-postgis: 28 33 @for version in $(POSTGIS_VERSIONS) ; do \ 29 - 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 ; \ 34 + ${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 ; \ 30 35 done 31 - 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 36 + ${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 32 37 33 - push_postgis: 38 + push-postgis: build-postgis 34 39 @for version in $(POSTGIS_VERSIONS) ; do \ 35 - 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 ; \ 40 + ${DOCKER} push ${POSTGIS_IMAGE_ID}:$$version ; \ 41 + ${DOCKER} push ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,$$version)); \ 36 42 done 37 - 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 43 + ${DOCKER} push ${POSTGIS_IMAGE_ID}:${POSTGIS_LATEST_VERSION} 44 + ${DOCKER} push ${POSTGIS_IMAGE_ID}:$(word 1, $(subst -, ,${POSTGIS_LATEST_VERSION})) 45 + ${DOCKER} push ${POSTGIS_IMAGE_ID}:latest 38 46 39 - build: build_postgres build_postgis 47 + build: build-postgres build-postgis 40 48 41 - push: push_postgres push_postgis 49 + push: push-postgres push-postgis
-6
postgis/11-2.5/Dockerfile
··· 1 - FROM postgis/postgis:11-2.5-alpine 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgis/12-3.0/Dockerfile
··· 1 - FROM postgis/postgis:12-3.0-alpine 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgis/13-3.1/Dockerfile
··· 1 - FROM postgis/postgis:13-3.1-alpine 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgis/14-3.4/Dockerfile
··· 1 - FROM postgis/postgis:14-3.4-alpine 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgis/15-3.4/Dockerfile
··· 1 - FROM postgis/postgis:15-3.4-alpine 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgis/16-3.4/Dockerfile
··· 1 - FROM postgis/postgis:16-3.4-alpine 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
+12
postgis/Dockerfile
··· 1 + # parametrize docker image and tag 2 + # ------------------------------------------------------------------------------ 3 + ARG POSTGIS_IMAGE=docker.io/postgis/postgis 4 + ARG POSTGIS_VERSION=16-3.4 5 + FROM ${POSTGIS_IMAGE}:${POSTGIS_VERSION}-alpine 6 + 7 + # copy maintenance scripts 8 + # ------------------------------------------------------------------------------ 9 + COPY ./maintenance /usr/local/bin/maintenance 10 + RUN chmod +x /usr/local/bin/maintenance/* 11 + RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 12 + && rmdir /usr/local/bin/maintenance
-6
postgres/10/Dockerfile
··· 1 - FROM postgres:10 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgres/11/Dockerfile
··· 1 - FROM postgres:11 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgres/12/Dockerfile
··· 1 - FROM postgres:12 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgres/13/Dockerfile
··· 1 - FROM postgres:13 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgres/14/Dockerfile
··· 1 - FROM postgres:14 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgres/15/Dockerfile
··· 1 - FROM postgres:15 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
-6
postgres/16/Dockerfile
··· 1 - FROM postgres:16 2 - 3 - COPY ./maintenance /usr/local/bin/maintenance 4 - RUN chmod +x /usr/local/bin/maintenance/* 5 - RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 6 - && rmdir /usr/local/bin/maintenance
+14
postgres/Dockerfile
··· 1 + # parametrize docker image and tag 2 + # ------------------------------------------------------------------------------ 3 + ARG POSTGRES_IMAGE=docker.io/postgres 4 + ARG POSTGRES_VERSION=16 5 + 6 + FROM ${POSTGRES_IMAGE}:${POSTGRES_VERSION} 7 + 8 + # copy maintenance scripts 9 + # ------------------------------------------------------------------------------ 10 + 11 + COPY ./maintenance /usr/local/bin/maintenance 12 + RUN chmod +x /usr/local/bin/maintenance/* 13 + RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ 14 + && rmdir /usr/local/bin/maintenance