Skip to content

Commit

Permalink
Added support PostgreSQL v17rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
CHERTS committed Sep 24, 2024
1 parent 2bb4fff commit ad4c8f8
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- "14/**"
- "15/**"
- "16/**"
- "17/**"
- "build.sh"
pull_request:
paths:
Expand All @@ -17,6 +18,7 @@ on:
- "14/**"
- "15/**"
- "16/**"
- "17/**"
- "build.sh"

jobs:
Expand Down Expand Up @@ -155,3 +157,30 @@ jobs:
- name: Test image cherts/pg-repack:${{ env.PGREPACK_VERSION }}
run: |
docker run --rm --name pg_repack cherts/pg-repack:${{ env.PGREPACK_VERSION }} --version
postgres-17:
runs-on: ubuntu-latest
steps:
- name: Set variables
run: |
echo "PGREPACK_VERSION=1.5.1" >> $GITHUB_ENV
echo "PG_VERSION=17" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image cherts/pg-repack:${{ env.PGREPACK_VERSION }}
uses: docker/build-push-action@v5
with:
context: ./${{ env.PG_VERSION }}
load: true
file: ./${{ env.PG_VERSION }}/Dockerfile
platforms: linux/amd64
tags: cherts/pg-repack:${{ env.PGREPACK_VERSION }}
- name: Inspect image cherts/pg-repack:${{ env.PGREPACK_VERSION }}
run: |
docker image inspect cherts/pg-repack:${{ env.PGREPACK_VERSION }}
- name: Test image cherts/pg-repack:${{ env.PGREPACK_VERSION }}
run: |
docker run --rm --name pg_repack cherts/pg-repack:${{ env.PGREPACK_VERSION }} --version
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ jobs:
file: ./16/Dockerfile
platforms: linux/amd64,linux/arm64
tags: cherts/pg-repack:1.5.0

- name: Build and push image cherts/pg-repack:1.5.1
uses: docker/build-push-action@v5
with:
push: true
cache-from: type=gha,scope=pg-repack
cache-to: type=gha,mode=max,scope=pg-repack
context: ./17
file: ./17/Dockerfile
platforms: linux/amd64,linux/arm64
tags: cherts/pg-repack:1.5.1
2 changes: 2 additions & 0 deletions 15/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RUN set -eux; \
zlib-dev \
icu-dev \
lz4-dev \
zstd-dev \
readline-dev \
; \
\
Expand Down Expand Up @@ -87,6 +88,7 @@ RUN set -eux; \
--with-icu \
--with-llvm \
--with-lz4 \
--with-zstd \
; \
make -j "$(nproc)" world; \
make install-world; \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RUN set -eux; \
zlib-dev \
icu-dev \
lz4-dev \
zstd-dev \
readline-dev \
; \
\
Expand Down
130 changes: 130 additions & 0 deletions 17/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
FROM alpine:3.20

ENV PG_MAJOR 17
ENV PG_VERSION 17rc1
ENV PG_SHA256 cef689e2de8c3d605d8406c065573b8d70859fc6f2a8d720b0d98a6d62ef16e8
ENV PG_REPACK_VERSION 1.5.1

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 \
zstd-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-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 \
--with-zstd \
; \
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"]
13 changes: 13 additions & 0 deletions 17/docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

ARG1=$1

case "${ARG1}" in
"bash" | "sh" | "psql" | "pgbench" | "pg_dump" | "pg_dumpall" | "pg_basebackup" | "pg_restore" | "pg_verifybackup" | "pg_controldata")
echo ${ARG1}
exec "$@"
;;
*)
exec /usr/local/bin/pg_repack "$@"
;;
esac
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This images follows the pg_repack releases + compatibility with PostgreSQL.

| image | postgres | pg_repack |
|-------|----------|-----------|
| cherts/pg-repack:1.5.1 | 17 | 1.5.1 |
| 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 |
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PG_REPACK=(
"14,1.4.7"
"15,1.4.8"
"16,1.5.0"
"17,1.5.1"
)

# Check command exist function
Expand Down

0 comments on commit ad4c8f8

Please sign in to comment.