8000 feat: add supautils to docker image · sorokinvld/postgres@e61631f · GitHub
[go: up one dir, main page]

Skip to content

Commit e61631f

Browse files
committed
feat: add supautils to docker image
1 parent c2c2ed1 commit e61631f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ARG hypopg_release=1.3.1
3535
ARG pg_repack_release=1.4.8
3636
ARG pgvector_release=0.4.0
3737
ARG pg_tle_release=1.0.1
38+
ARG supautils_release=1.7.2
3839

3940
FROM postgres:${postgresql_release} as base
4041
# Redeclare args for use in subsequent stages
@@ -714,6 +715,33 @@ RUN --mount=type=cache,target=/ccache,from=public.ecr.aws/supabase/postgres:ccac
714715
# Create debian package
715716
RUN checkinstall -D --install=no --fstrans=no --backup=no --pakdir=/tmp --nodoc
716717

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+
717745
####################
718746
# Collect extension packages
719747
####################
@@ -746,6 +774,7 @@ COPY --from=hypopg /tmp/*.deb /tmp/
746774
COPY --from=pg_repack /tmp/*.deb /tmp/
747775
COPY --from=pgvector /tmp/*.deb /tmp/
748776
COPY --from=pg_tle /tmp/*.deb /tmp/
777+
COPY --from=supautils /tmp/*.deb /tmp/
749778

750779
####################
751780
# Build final image
@@ -764,9 +793,13 @@ COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j
764793
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_hba.conf.j2 /etc/postgresql/pg_hba.conf
765794
COPY --chown=postgres:postgres ansible/files/postgresql_config/pg_ident.conf.j2 /etc/postgresql/pg_ident.conf
766795
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
767798
COPY --chown=postgres:postgres ansible/files/pgsodium_getkey_urandom.sh.j2 /usr/lib/postgresql/${postgresql_major}/bin/pgsodium_getkey.sh
768799

769800
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 && \
770803
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
771804
echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
772805
echo "pgsodium.getkey_script= '/usr/lib/postgresql/${postgresql_major}/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \

0 commit comments

Comments
 (0)
0