diff --git a/12/Dockerfile b/12/Dockerfile new file mode 100644 index 0000000..43c8bae --- /dev/null +++ b/12/Dockerfile @@ -0,0 +1,127 @@ +FROM alpine:3.19 + +ENV PG_MAJOR 12 +ENV PG_VERSION 12.18 +ENV PG_SHA256 4f9919725d941ce9868e07fe1ed1d3a86748599b483386547583928b74c3918a +ENV PG_REPACK_VERSION 1.4.5 + +ENV LANG en_US.utf8 +WORKDIR /pg_repack + +ENV DOCKER_PG_LLVM_DEPS \ + llvm15-dev \ + clang15 + +RUN set -eux; \ + \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ + --extract \ + --file postgresql.tar.bz2 \ + --directory /usr/src/postgresql \ + --strip-components 1 \ + ; \ + rm postgresql.tar.bz2; \ + \ + apk add --no-cache --virtual .build-deps \ + $DOCKER_PG_LLVM_DEPS \ + bison \ + coreutils \ + dpkg-dev dpkg \ + flex \ + g++ \ + gcc \ + krb5-dev \ + libc-dev \ + libedit-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + make \ + openldap-dev \ + openssl-dev \ + perl-dev \ + perl-ipc-run \ + perl-utils \ + python3-dev \ + tcl-dev \ + util-linux-dev \ + zlib-dev \ + icu-dev \ + readline-dev \ + ; \ + \ + cd /usr/src/postgresql; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + \ + export LLVM_CONFIG="/usr/lib/llvm15/bin/llvm-config"; \ + export CLANG=clang-15; \ + \ + ./configure \ + --enable-option-checking=fatal \ + --build="$gnuArch" \ + --enable-integer-datetimes \ + --enable-thread-safety \ + --enable-tap-tests \ + --disable-rpath \ + --with-uuid=e2fs \ + --with-gnu-ld \ + --with-pgport=5432 \ + --with-system-tzdata=/usr/share/zoneinfo \ + --prefix=/usr/local \ + --with-includes=/usr/local/include \ + --with-libraries=/usr/local/lib \ + --with-gssapi \ + --with-ldap \ + --with-tcl \ + --with-perl \ + --with-python \ + --with-openssl \ + --with-libxml \ + --with-libxslt \ + --with-icu \ + --with-llvm \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | grep -v -e perl -e python -e tcl \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ + $runDeps \ + bash \ + su-exec \ + tzdata \ + zstd \ + icu-data-full \ + $([ "$(apk --print-arch)" != 'ppc64le' ] && echo 'nss_wrapper') \ + ; \ + wget -O pg_repack.zip http://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + && unzip pg_repack.zip || true && rm -f pg_repack.zip \ + && cd pg_repack-${PG_REPACK_VERSION} \ + && make \ + && make install; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ + /usr/src/postgresql \ + /usr/local/share/doc \ + /usr/local/share/man \ + ; \ + \ + pg_repack --version + +COPY docker_entrypoint.sh /bin/ + +ENTRYPOINT ["/bin/docker_entrypoint.sh"] +CMD ["-no-superuser-check"] diff --git a/12/docker_entrypoint.sh b/12/docker_entrypoint.sh new file mode 100755 index 0000000..4871af6 --- /dev/null +++ b/12/docker_entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +ARG1=$1 + +case "${ARG1}" in +"bash" | "sh" | "psql" | "pgbench" | "pg_dump" | "pg_dumpall") + echo ${ARG1} + exec "$@" + ;; +*) + exec /usr/local/bin/pg_repack "$@" + ;; +esac diff --git a/13/Dockerfile b/13/Dockerfile new file mode 100644 index 0000000..d227dd3 --- /dev/null +++ b/13/Dockerfile @@ -0,0 +1,127 @@ +FROM alpine:3.19 + +ENV PG_MAJOR 13 +ENV PG_VERSION 13.14 +ENV PG_SHA256 b8df078551898960bd500dc5d38a177e9905376df81fe7f2b660a1407fa6a5ed +ENV PG_REPACK_VERSION 1.4.6 + +ENV LANG en_US.utf8 +WORKDIR /pg_repack + +ENV DOCKER_PG_LLVM_DEPS \ + llvm15-dev \ + clang15 + +RUN set -eux; \ + \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ + --extract \ + --file postgresql.tar.bz2 \ + --directory /usr/src/postgresql \ + --strip-components 1 \ + ; \ + rm postgresql.tar.bz2; \ + \ + apk add --no-cache --virtual .build-deps \ + $DOCKER_PG_LLVM_DEPS \ + bison \ + coreutils \ + dpkg-dev dpkg \ + flex \ + g++ \ + gcc \ + krb5-dev \ + libc-dev \ + libedit-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + make \ + openldap-dev \ + openssl-dev \ + perl-dev \ + perl-ipc-run \ + perl-utils \ + python3-dev \ + tcl-dev \ + util-linux-dev \ + zlib-dev \ + icu-dev \ + readline-dev \ + ; \ + \ + cd /usr/src/postgresql; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + \ + export LLVM_CONFIG="/usr/lib/llvm15/bin/llvm-config"; \ + export CLANG=clang-15; \ + \ + ./configure \ + --enable-option-checking=fatal \ + --build="$gnuArch" \ + --enable-integer-datetimes \ + --enable-thread-safety \ + --enable-tap-tests \ + --disable-rpath \ + --with-uuid=e2fs \ + --with-gnu-ld \ + --with-pgport=5432 \ + --with-system-tzdata=/usr/share/zoneinfo \ + --prefix=/usr/local \ + --with-includes=/usr/local/include \ + --with-libraries=/usr/local/lib \ + --with-gssapi \ + --with-ldap \ + --with-tcl \ + --with-perl \ + --with-python \ + --with-openssl \ + --with-libxml \ + --with-libxslt \ + --with-icu \ + --with-llvm \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | grep -v -e perl -e python -e tcl \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ + $runDeps \ + bash \ + su-exec \ + tzdata \ + zstd \ + icu-data-full \ + $([ "$(apk --print-arch)" != 'ppc64le' ] && echo 'nss_wrapper') \ + ; \ + wget -O pg_repack.zip http://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + && unzip pg_repack.zip || true && rm -f pg_repack.zip \ + && cd pg_repack-${PG_REPACK_VERSION} \ + && make \ + && make install; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ + /usr/src/postgresql \ + /usr/local/share/doc \ + /usr/local/share/man \ + ; \ + \ + pg_repack --version + +COPY docker_entrypoint.sh /bin/ + +ENTRYPOINT ["/bin/docker_entrypoint.sh"] +CMD ["-no-superuser-check"] diff --git a/13/docker_entrypoint.sh b/13/docker_entrypoint.sh new file mode 100755 index 0000000..fdb08b9 --- /dev/null +++ b/13/docker_entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +ARG1=$1 + +case "${ARG1}" in +"bash" | "sh" | "psql" | "pgbench" | "pg_dump" | "pg_dumpall") + echo ${ARG1} + exec "$@" + ;; +*) + exec /usr/local/bin/pg_repack "$@" + ;; +esac \ No newline at end of file diff --git a/14/Dockerfile b/14/Dockerfile new file mode 100644 index 0000000..76ae67d --- /dev/null +++ b/14/Dockerfile @@ -0,0 +1,129 @@ +FROM alpine:3.19 + +ENV PG_MAJOR 14 +ENV PG_VERSION 14.11 +ENV PG_SHA256 a670bd7dce22dcad4297b261136b3b1d4a09a6f541719562aa14ca63bf2968a8 +ENV PG_REPACK_VERSION 1.4.7 + +ENV LANG en_US.utf8 +WORKDIR /pg_repack + +ENV DOCKER_PG_LLVM_DEPS \ + llvm15-dev \ + clang15 + +RUN set -eux; \ + \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ + --extract \ + --file postgresql.tar.bz2 \ + --directory /usr/src/postgresql \ + --strip-components 1 \ + ; \ + rm postgresql.tar.bz2; \ + \ + apk add --no-cache --virtual .build-deps \ + $DOCKER_PG_LLVM_DEPS \ + bison \ + coreutils \ + dpkg-dev dpkg \ + flex \ + g++ \ + gcc \ + krb5-dev \ + libc-dev \ + libedit-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + make \ + openldap-dev \ + openssl-dev \ + perl-dev \ + perl-ipc-run \ + perl-utils \ + python3-dev \ + tcl-dev \ + util-linux-dev \ + zlib-dev \ + icu-dev \ + lz4-dev \ + readline-dev \ + ; \ + \ + cd /usr/src/postgresql; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + \ + export LLVM_CONFIG="/usr/lib/llvm15/bin/llvm-config"; \ + export CLANG=clang-15; \ + \ + ./configure \ + --enable-option-checking=fatal \ + --build="$gnuArch" \ + --enable-integer-datetimes \ + --enable-thread-safety \ + --enable-tap-tests \ + --disable-rpath \ + --with-uuid=e2fs \ + --with-gnu-ld \ + --with-pgport=5432 \ + --with-system-tzdata=/usr/share/zoneinfo \ + --prefix=/usr/local \ + --with-includes=/usr/local/include \ + --with-libraries=/usr/local/lib \ + --with-gssapi \ + --with-ldap \ + --with-tcl \ + --with-perl \ + --with-python \ + --with-openssl \ + --with-libxml \ + --with-libxslt \ + --with-icu \ + --with-llvm \ + --with-lz4 \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | grep -v -e perl -e python -e tcl \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ + $runDeps \ + bash \ + su-exec \ + tzdata \ + zstd \ + icu-data-full \ + $([ "$(apk --print-arch)" != 'ppc64le' ] && echo 'nss_wrapper') \ + ; \ + wget -O pg_repack.zip http://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + && unzip pg_repack.zip || true && rm -f pg_repack.zip \ + && cd pg_repack-${PG_REPACK_VERSION} \ + && make \ + && make install; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ + /usr/src/postgresql \ + /usr/local/share/doc \ + /usr/local/share/man \ + ; \ + \ + pg_repack --version + +COPY docker_entrypoint.sh /bin/ + +ENTRYPOINT ["/bin/docker_entrypoint.sh"] +CMD ["-no-superuser-check"] diff --git a/14/docker_entrypoint.sh b/14/docker_entrypoint.sh new file mode 100755 index 0000000..fdb08b9 --- /dev/null +++ b/14/docker_entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +ARG1=$1 + +case "${ARG1}" in +"bash" | "sh" | "psql" | "pgbench" | "pg_dump" | "pg_dumpall") + echo ${ARG1} + exec "$@" + ;; +*) + exec /usr/local/bin/pg_repack "$@" + ;; +esac \ No newline at end of file diff --git a/15/Dockerfile b/15/Dockerfile new file mode 100644 index 0000000..dd9724a --- /dev/null +++ b/15/Dockerfile @@ -0,0 +1,129 @@ +FROM alpine:3.19 + +ENV PG_MAJOR 15 +ENV PG_VERSION 15.6 +ENV PG_SHA256 8455146ed9c69c93a57de954aead0302cafad035c2b242175d6aa1e17ebcb2fb +ENV PG_REPACK_VERSION 1.4.8 + +ENV LANG en_US.utf8 +WORKDIR /pg_repack + +ENV DOCKER_PG_LLVM_DEPS \ + llvm15-dev \ + clang15 + +RUN set -eux; \ + \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ + --extract \ + --file postgresql.tar.bz2 \ + --directory /usr/src/postgresql \ + --strip-components 1 \ + ; \ + rm postgresql.tar.bz2; \ + \ + apk add --no-cache --virtual .build-deps \ + $DOCKER_PG_LLVM_DEPS \ + bison \ + coreutils \ + dpkg-dev dpkg \ + flex \ + g++ \ + gcc \ + krb5-dev \ + libc-dev \ + libedit-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + make \ + openldap-dev \ + openssl-dev \ + perl-dev \ + perl-ipc-run \ + perl-utils \ + python3-dev \ + tcl-dev \ + util-linux-dev \ + zlib-dev \ + icu-dev \ + lz4-dev \ + readline-dev \ + ; \ + \ + cd /usr/src/postgresql; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + \ + export LLVM_CONFIG="/usr/lib/llvm15/bin/llvm-config"; \ + export CLANG=clang-15; \ + \ + ./configure \ + --enable-option-checking=fatal \ + --build="$gnuArch" \ + --enable-integer-datetimes \ + --enable-thread-safety \ + --enable-tap-tests \ + --disable-rpath \ + --with-uuid=e2fs \ + --with-gnu-ld \ + --with-pgport=5432 \ + --with-system-tzdata=/usr/share/zoneinfo \ + --prefix=/usr/local \ + --with-includes=/usr/local/include \ + --with-libraries=/usr/local/lib \ + --with-gssapi \ + --with-ldap \ + --with-tcl \ + --with-perl \ + --with-python \ + --with-openssl \ + --with-libxml \ + --with-libxslt \ + --with-icu \ + --with-llvm \ + --with-lz4 \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | grep -v -e perl -e python -e tcl \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ + $runDeps \ + bash \ + su-exec \ + tzdata \ + zstd \ + icu-data-full \ + $([ "$(apk --print-arch)" != 'ppc64le' ] && echo 'nss_wrapper') \ + ; \ + wget -O pg_repack.zip http://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + && unzip pg_repack.zip || true && rm -f pg_repack.zip \ + && cd pg_repack-${PG_REPACK_VERSION} \ + && make \ + && make install; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ + /usr/src/postgresql \ + /usr/local/share/doc \ + /usr/local/share/man \ + ; \ + \ + pg_repack --version + +COPY docker_entrypoint.sh /bin/ + +ENTRYPOINT ["/bin/docker_entrypoint.sh"] +CMD ["-no-superuser-check"] diff --git a/15/docker_entrypoint.sh b/15/docker_entrypoint.sh new file mode 100755 index 0000000..fdb08b9 --- /dev/null +++ b/15/docker_entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +ARG1=$1 + +case "${ARG1}" in +"bash" | "sh" | "psql" | "pgbench" | "pg_dump" | "pg_dumpall") + echo ${ARG1} + exec "$@" + ;; +*) + exec /usr/local/bin/pg_repack "$@" + ;; +esac \ No newline at end of file diff --git a/16/Dockerfile b/16/Dockerfile new file mode 100644 index 0000000..bb8ef0f --- /dev/null +++ b/16/Dockerfile @@ -0,0 +1,129 @@ +FROM alpine:3.19 + +ENV PG_MAJOR 16 +ENV PG_VERSION 16.2 +ENV PG_SHA256 446e88294dbc2c9085ab4b7061a646fa604b4bec03521d5ea671c2e5ad9b2952 +ENV PG_REPACK_VERSION 1.5.0 + +ENV LANG en_US.utf8 +WORKDIR /pg_repack + +ENV DOCKER_PG_LLVM_DEPS \ + llvm15-dev \ + clang15 + +RUN set -eux; \ + \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ + --extract \ + --file postgresql.tar.bz2 \ + --directory /usr/src/postgresql \ + --strip-components 1 \ + ; \ + rm postgresql.tar.bz2; \ + \ + apk add --no-cache --virtual .build-deps \ + $DOCKER_PG_LLVM_DEPS \ + bison \ + coreutils \ + dpkg-dev dpkg \ + flex \ + g++ \ + gcc \ + krb5-dev \ + libc-dev \ + libedit-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + make \ + openldap-dev \ + openssl-dev \ + perl-dev \ + perl-ipc-run \ + perl-utils \ + python3-dev \ + tcl-dev \ + util-linux-dev \ + zlib-dev \ + icu-dev \ + lz4-dev \ + readline-dev \ + ; \ + \ + cd /usr/src/postgresql; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + \ + export LLVM_CONFIG="/usr/lib/llvm15/bin/llvm-config"; \ + export CLANG=clang-15; \ + \ + ./configure \ + --enable-option-checking=fatal \ + --build="$gnuArch" \ + --enable-integer-datetimes \ + --enable-thread-safety \ + --enable-tap-tests \ + --disable-rpath \ + --with-uuid=e2fs \ + --with-gnu-ld \ + --with-pgport=5432 \ + --with-system-tzdata=/usr/share/zoneinfo \ + --prefix=/usr/local \ + --with-includes=/usr/local/include \ + --with-libraries=/usr/local/lib \ + --with-gssapi \ + --with-ldap \ + --with-tcl \ + --with-perl \ + --with-python \ + --with-openssl \ + --with-libxml \ + --with-libxslt \ + --with-icu \ + --with-llvm \ + --with-lz4 \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | grep -v -e perl -e python -e tcl \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ + $runDeps \ + bash \ + su-exec \ + tzdata \ + zstd \ + icu-data-full \ + $([ "$(apk --print-arch)" != 'ppc64le' ] && echo 'nss_wrapper') \ + ; \ + wget -O pg_repack.zip http://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + && unzip pg_repack.zip || true && rm -f pg_repack.zip \ + && cd pg_repack-${PG_REPACK_VERSION} \ + && make \ + && make install; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ + /usr/src/postgresql \ + /usr/local/share/doc \ + /usr/local/share/man \ + ; \ + \ + pg_repack --version + +COPY docker_entrypoint.sh /bin/ + +ENTRYPOINT ["/bin/docker_entrypoint.sh"] +CMD ["-no-superuser-check"] diff --git a/16/docker_entrypoint.sh b/16/docker_entrypoint.sh new file mode 100755 index 0000000..fdb08b9 --- /dev/null +++ b/16/docker_entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +ARG1=$1 + +case "${ARG1}" in +"bash" | "sh" | "psql" | "pgbench" | "pg_dump" | "pg_dumpall") + echo ${ARG1} + exec "$@" + ;; +*) + exec /usr/local/bin/pg_repack "$@" + ;; +esac \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..498c3f5 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# pg_repack docker image (using alpine linux) + +Docker image with 'pg_repack' (PostgreSQL extension) installed, can be run natively - or be used 'client-side' to run/invoke pg_repack functionality +for a PostgreSQL database with the extension installed. + +Reference: https://github.com/reorg/pg_repack + +## Versions + +This images follows the pg_repack releases + compatibility with PostgreSQL. + +| image | postgres | pg_repack | +|-------|----------|-----------| +| cherts/pg-repack:1.5.0 | 16 | 1.5.0 | +| cherts/pg-repack:1.4.8 | 15 | 1.4.8 | +| cherts/pg-repack:1.4.7 | 14 | 1.4.7 | +| cherts/pg-repack:1.4.6 | 13 | 1.4.6 | +| cherts/pg-repack:1.4.5 | 12 | 1.4.5 | + +## Dockerhub + +https://hub.docker.com/r/cherts/pg-repack/ + + +### Build image + +``` +git clone https://github.com/CHERTS/pg_repack_docker.git +cd pg_repack_docker +./build.sh +``` + +### Run pg_repack + +This image contains the pg_repack utility to run with the official images [postgres docker image](https://hub.docker.com/_/postgres/) + +This image may be required to run pg_repack on your computer if your postgres is running in cloud or in a container (kubernetes) that already has the pg_repack extension. + +``` +# use pg_repack v1.5.0 +docker run -it --rm --name pg_repack cherts/pg-repack:1.5.0 --version +docker run -it --rm --name pg_repack cherts/pg-repack:1.5.0 -h X.X.X.X -U postgres --dbname=dbname --dry-run --table=table1 --only-indexes --no-superuser-check +``` diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..4c96295 --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +PG_REPACK=( + "12,1.4.5" + "13,1.4.6" + "14,1.4.7" + "15,1.4.8" + "16,1.5.0" +) + +# trap ctrl-c and call ctrl_c() +trap ctrl_c INT + +function ctrl_c() { + echo "** Trapped CTRL-C" + exit 1 +} + +for DATA in ${PG_REPACK[@]}; do + PG_VER=$(echo "${DATA}" | awk -F',' '{print $1}') + PGREPACK_VER=$(echo "${DATA}" | awk -F',' '{print $2}') + echo "Docker build image 'pg-repack:${PGREPACK_VER}', postgres v${PG_VER}..." + docker build -t cherts/pg-repack:${PGREPACK_VER} --no-cache --progress=plain -f ${PG_VER}/Dockerfile ${PG_VER} + if [ $? -eq 0 ]; then + echo "Docker push image 'pg-repack:${PGREPACK_VER}'..." + docker push cherts/pg-repack:${PGREPACK_VER} + else + echo "ERROR: Failed build image 'pg-repack:${PGREPACK_VER}', postgres v${PG_VER}" + exit 1 + fi +done \ No newline at end of file