@@ -35,6 +35,7 @@ ARG hypopg_release=1.3.1
35
35
ARG pg_repack_release=1.4.8
36
36
ARG pgvector_release=0.4.0
37
37
ARG pg_tle_release=1.0.1
38
+ ARG supautils_release=1.7.2
38
39
39
40
FROM postgres:${postgresql_release} as base
40
41
# Redeclare args for use in subsequent stages
@@ -714,6 +715,33 @@ RUN --mount=type=cache,target=/ccache,from=public.ecr.aws/supabase/postgres:ccac
714
715
# Create debian package
715
716
RUN checkinstall -D --install=no --fstrans=no --backup=no --pakdir=/tmp --nodoc
716
717
718
+ # ###################
719
+ # internal/supautils.yml
720
+ # ###################
721
+ FROM ccache as supautils-source
722
+ ARG supautils_release
723
+ ARG supautils_release_checksum
724
+ ADD --checksum=${supautils_release_checksum} \
725
+ "https://github.com/supabase/supautils/archive/refs/tags/v${supautils_release}.tar.gz" /tmp/supautils.tar.gz
726
+ RUN tar -xvf /tmp/supautils.tar.gz -C /tmp && \
727
+ rm -rf /tmp/supautils.tar.gz
728
+ # Install build dependencies
729
+ RUN apt-get update && apt-get install -y \
730
+ libicu-dev \
731
+ && rm -rf /var/lib/apt/lists/*
732
+ # Build from source
733
+ WORKDIR /tmp/supautils-${supautils_release}
734
+ RUN --mount=type=cache,target=/ccache,from=public.ecr.aws/supabase/postgres:ccache \
735
+ make -j$(nproc)
736
+ # Create debian package
737
+ RUN checkinstall -D --install=no --fstrans=no --backup=no --pakdir=/tmp --nodoc
738
+
739
+ FROM base as supautils
740
+ # Download package archive
741
+ ARG supautils_release
742
+ ADD "https://github.com/supabase/supautils/releases/download/v${supautils_release}/supautils-v${supautils_release}-pg${postgresql_major}-${TARGETARCH}-linux-gnu.deb" \
743
+ /tmp/supautils.deb
744
+
717
745
# ###################
718
746
# Collect extension packages
719
747
# ###################
@@ -746,6 +774,7 @@ COPY --from=hypopg /tmp/*.deb /tmp/
746
774
COPY --from=pg_repack /tmp/*.deb /tmp/
747
775
COPY --from=pgvector /tmp/*.deb /tmp/
748
776
COPY --from=pg_tle /tmp/*.deb /tmp/
777
+ COPY --from=supautils /tmp/*.deb /tmp/
749
778
750
779
# ###################
751
780
# Build final image
@@ -764,9 +793,13 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j
764
793
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
765
794
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
766
795
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql-stdout-log.conf /etc/postgresql/logging.conf
796
+ COPY --chown=postgres:postgres ansible/files/postgresql_config/supautils.conf.j2 /etc/postgresql-custom/supautils.conf
797
+ COPY --chown=postgres:postgres ansible/files/postgresql_extension_custom_scripts /etc/postgresql-custom/extension-custom-scripts
767
798
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/${postgresql_major}/bin/pgsodium_getkey.sh
768
799
769
800
RUN sed -i "s/#unix_socket_directories = '\/ tmp'/unix_socket_directories = '\/ var\/ run\/ postgresql'/g" /etc/postgresql/postgresql.conf && \
801
+ sed -i "s/#session_preload_libraries = ''/session_preload_libraries = 'supautils'/g" /etc/postgresql/postgresql.conf && \
802
+ sed -i "s/#include = '\/ etc\/ postgresql-custom\/ supautils.conf'/include = '\/ etc\/ postgresql-custom\/ supautils.conf'/g" /etc/postgresql/postgresql.conf && \
770
803
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
771
804
echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
772
805
echo "pgsodium.getkey_script= '/usr/lib/postgresql/${postgresql_major}/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
0 commit comments