From d9aa901c6d19a3cd9cb661eede92d5bbfccc5e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Tavares?= Date: Mon, 7 Apr 2025 19:18:22 +0100 Subject: [PATCH] add pg_rest --- compute/compute-node.Dockerfile | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/compute/compute-node.Dockerfile b/compute/compute-node.Dockerfile index 83cbacf034..65544170c0 100644 --- a/compute/compute-node.Dockerfile +++ b/compute/compute-node.Dockerfile @@ -1527,6 +1527,44 @@ COPY --from=pgauditlogtofile-src /ext-src/ /ext-src/ WORKDIR /ext-src/pgauditlogtofile-src RUN make install USE_PGXS=1 -j $(getconf _NPROCESSORS_ONLN) +######################################################################################### +# +# Layer "pg_rest-build" +# compile pg_rest extension +# +######################################################################################### +FROM build-deps AS pg_rest-src +ARG PG_VERSION +ARG VERSION=3.0.1 + +# Only supported for PostgreSQL v17 +RUN if [ "${PG_VERSION:?}" != "v17" ]; then \ + echo "pg_rest extension is only supported for PostgreSQL v17" && exit 1; \ + fi + +WORKDIR /ext-src +RUN mkdir -p pg_rest-src && cd pg_rest-src && \ + wget https://github.com/ruslantalpa/foxfirebase/raw/main/pg_rest_pg17-${VERSION}_aarch64.deb -O pg_rest_pg17-${VERSION}_aarch64.deb && \ + wget https://github.com/ruslantalpa/foxfirebase/raw/main/pg_rest_pg17-${VERSION}_amd64.deb -O pg_rest_pg17-${VERSION}_amd64.deb + +FROM pg-build AS pg_rest-build +ARG VERSION=3.0.1 +COPY --from=pg_rest-src /ext-src/ /ext-src/ +WORKDIR /ext-src/pg_rest-src +RUN export ARCH=$(uname -m) && \ + echo "ARCH: $ARCH" && \ + # Map architecture names to package names + if [ "$ARCH" = "x86_64" ]; then \ + PACKAGE_ARCH="amd64"; \ + else \ + PACKAGE_ARCH="$ARCH"; \ + fi && \ + echo "Using package architecture: $PACKAGE_ARCH" && \ + apt-get update && \ + apt-get install -y ./pg_rest_pg17-${VERSION}_${PACKAGE_ARCH}.deb && \ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ + echo 'trusted = true' >> /usr/local/pgsql/share/extension/pg_rest.control + ######################################################################################### # # Layer "neon-ext-build" @@ -1622,6 +1660,7 @@ COPY --from=pg_duckdb-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=pg_repack-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=pgaudit-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=pgauditlogtofile-build /usr/local/pgsql/ /usr/local/pgsql/ +COPY --from=pg_rest-build /usr/local/pgsql/ /usr/local/pgsql/ ######################################################################################### # @@ -1798,6 +1837,7 @@ COPY --from=pg_repack-src /ext-src/ /ext-src/ COPY --from=pg_repack-build /usr/local/pgsql/ /usr/local/pgsql/ COPY compute/patches/pg_repack.patch /ext-src RUN cd /ext-src/pg_repack-src && patch -p1