diff --git a/Dockerfile b/Dockerfile index 0627d9c3..e1b3989a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -109,6 +109,7 @@ RUN apk add --no-cache grep libpq postgresql-common # To get support for psql 9.6 need create the folder for 9.6, use alpine 3.6 and use these lines: # echo "http://dl-cdn.alpinelinux.org/alpine/v3.6/main" > psql_repos # apk fetch --no-cache --repositories-file psql_repos postgresql-client postgresql-dev -o "$APK_POSTGRES_DIR/9.6" +# Create the directories for each PostgreSQL version RUN set -eux; \ mkdir -p \ "$APK_POSTGRES_DIR/10" \ @@ -118,19 +119,46 @@ RUN set -eux; \ "$APK_POSTGRES_DIR/14" \ "$APK_POSTGRES_DIR/15" \ "$APK_POSTGRES_DIR/16" \ - "$APK_POSTGRES_DIR/latest"; \ + "$APK_POSTGRES_DIR/latest" + +# Fetch the PostgreSQL client for version 10 +RUN set -eux; \ echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" > psql_repos; \ - apk fetch --no-cache --repositories-file psql_repos postgresql-client -o "$APK_POSTGRES_DIR/10"; \ + apk fetch --no-cache --repositories-file psql_repos postgresql-client -o "$APK_POSTGRES_DIR/10" + +# Fetch the PostgreSQL client for version 11 +RUN set -eux; \ echo "http://dl-cdn.alpinelinux.org/alpine/v3.10/main" > psql_repos; \ - apk fetch --no-cache --repositories-file psql_repos postgresql-client -o "$APK_POSTGRES_DIR/11"; \ + apk fetch --no-cache --repositories-file psql_repos postgresql-client -o "$APK_POSTGRES_DIR/11" + +# Fetch the PostgreSQL client for version 12 +RUN set -eux; \ echo "http://dl-cdn.alpinelinux.org/alpine/v3.12/main" > psql_repos; \ - apk fetch --no-cache --repositories-file psql_repos postgresql-client -o "$APK_POSTGRES_DIR/12"; \ - apk fetch --no-cache postgresql13-client -o "$APK_POSTGRES_DIR/13"; \ - apk fetch --no-cache postgresql14-client -o "$APK_POSTGRES_DIR/14"; \ - apk fetch --no-cache postgresql15-client -o "$APK_POSTGRES_DIR/15"; \ - apk fetch --no-cache postgresql16-client -o "$APK_POSTGRES_DIR/16"; \ - apk fetch --no-cache postgresql-client -o "$APK_POSTGRES_DIR/latest"; \ - rm psql_repos; + apk fetch --no-cache --repositories-file psql_repos postgresql-client -o "$APK_POSTGRES_DIR/12" + +# Fetch the PostgreSQL client for version 13 +RUN set -eux; \ + apk fetch --no-cache postgresql13-client -o "$APK_POSTGRES_DIR/13" + +# Fetch the PostgreSQL client for version 14 +RUN set -eux; \ + apk fetch --no-cache postgresql14-client -o "$APK_POSTGRES_DIR/14" + +# Fetch the PostgreSQL client for version 15 +RUN set -eux; \ + apk fetch --no-cache postgresql15-client -o "$APK_POSTGRES_DIR/15" + +# Fetch the PostgreSQL client for version 16 +RUN set -eux; \ + apk fetch --no-cache postgresql16-client -o "$APK_POSTGRES_DIR/16" + +# Fetch the latest PostgreSQL client +RUN set -eux; \ + apk fetch --no-cache postgresql-client -o "$APK_POSTGRES_DIR/latest" + +# Clean up +RUN set -eux; \ + rm psql_repos ENV JOB_200_WHAT set -euo pipefail; psql -0Atd postgres -c \"SELECT datname FROM pg_database WHERE NOT datistemplate AND datname != \'postgres\'\" | grep --null-data -E \"\$DBS_TO_INCLUDE\" | grep --null-data --invert-match -E \"\$DBS_TO_EXCLUDE\" | xargs -0tI DB pg_dump --dbname DB --no-owner --no-privileges --file \"\$SRC/DB.sql\" ENV JOB_200_WHEN='daily weekly' \