Skip to content

Commit 8341a69

Browse files
committed
add plrust build to dockerfile
1 parent f86bcd1 commit 8341a69

File tree

3 files changed

+76
-5
lines changed

3 files changed

+76
-5
lines changed

Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ ARG pgvector_release=0.4.0
3737
ARG pg_tle_release=1.0.3
3838
ARG supautils_release=1.7.2
3939
ARG wal_g_release=2.0.1
40+
ARG plrust_release=1.2.3
41+
ARG plrust_release_checksum
42+
ARG plrust_language_version=1.70.0
43+
ARG plrust_pgrx_version=0.9.7
44+
4045

4146
####################
4247
# Setup Postgres PPA
@@ -796,6 +801,74 @@ RUN --mount=type=cache,target=/ccache,from=public.ecr.aws/supabase/postgres:ccac
796801
# Create debian package
797802
RUN checkinstall -D --install=no --fstrans=no --backup=no --pakdir=/tmp --nodoc
798803

804+
####################
805+
# 30-plrust.yml
806+
####################
807+
FROM ccache as plrust-source
808+
ARG plrust_release
809+
ARG plrust_release_checksum
810+
ARG plrust_language_version=1.70.0
811+
ARG plrust_pgrx_version=0.9.7
812+
813+
ADD --checksum=${plrust_release_checksum} \
814+
"https://github.com/tcdi/plrust/archive/refs/tags/v${plrust_release}.tar.gz" \
815+
/tmp/plrust.tar.gz
816+
RUN tar -xvf /tmp/plrust.tar.gz -C /tmp && \
817+
rm -rf /tmp/plrust.tar.gz
818+
819+
RUN apt-get update && apt-get install -y --no-install-recommends \
820+
ca-certificates \
821+
clang \
822+
clang-11 \
823+
gcc \
824+
git \
825+
gnupg \
826+
libssl-dev \
827+
llvm-11 \
828+
lsb-release \
829+
make \
830+
pkg-config \
831+
wget \
832+
crossbuild-essential-arm64 \
833+
crossbuild-essential-amd64 \
834+
&& rm -rf /var/lib/apt/lists/*
835+
# Build from source
836+
WORKDIR /tmp/plrust-${plrust_release}
837+
838+
RUN wget -qO- https://sh.rustup.rs | \
839+
sh -s -- \
840+
-y \
841+
--profile minimal \
842+
--default-toolchain=${plrust_language_version}
843+
844+
# Make sure we have the cargo environment
845+
ENV PATH "/root/.cargo/bin:$PATH"
846+
847+
848+
# Install required Rust components and target
849+
RUN rustup toolchain install ${plrust_language_version} && \
850+
rustup default ${plrust_language_version} && \
851+
rustup component add llvm-tools-preview rustc-dev && \
852+
rustup target install x86_64-unknown-linux-gnu && \
853+
rustup target install aarch64-unknown-linux-gnu
854+
855+
# Install cargo-pgrx
856+
RUN cargo install cargo-pgrx --version ${plrust_pgrx_version} --locked && \
857+
cargo pgrx init --pg${postgresql_major} /usr/bin/pg_config
858+
859+
# build plrustc
860+
RUN cd plrustc && ./build.sh
861+
862+
RUN mv build/bin/plrustc /root/.cargo/bin/
863+
864+
RUN arch=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "$TARGETARCH") && \
865+
cd plrust && \
866+
PG_VER=${postgresql_major} \
867+
STD_TARGETS=$arch-unknown-linux-gnu \
868+
./build
869+
870+
RUN cargo pgrx package --profile=release --features trusted -c /usr/bin/pg_config --out-dir=/tmp
871+
799872
####################
800873
# internal/supautils.yml
801874
####################
@@ -850,6 +923,7 @@ COPY --from=hypopg-source /tmp/*.deb /tmp/
850923
COPY --from=pg_repack-source /tmp/*.deb /tmp/
851924
COPY --from=pgvector-source /tmp/*.deb /tmp/
852925
COPY --from=pg_tle-source /tmp/*.deb /tmp/
926+
COPY --from=plrust-source /tmp/*.deb /tmp/
853927
COPY --from=supautils /tmp/*.deb /tmp/
854928

855929
####################

ansible/playbook.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@
157157
cmd: /usr/lib/postgresql/bin/pg_ctl -D /var/lib/postgresql/data stop
158158
when: ebssurrogate_mode
159159

160-
- name: Run unit tests
161-
import_tasks: tasks/test-image.yml
162-
tags:
163-
- unit-tests
164-
165160
- name: Collect Postgres binaries
166161
import_tasks: tasks/internal/collect-pg-binaries.yml
167162
tags:

ansible/vars.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,6 @@ pg_tle_release: "1.0.4"
136136
pg_tle_release_checksum: sha256:679559584d83fb629c3b56825849fca4ff1fa3355b350aaaf8aa0b7b3460b08a
137137

138138
plrust_release: "1.2.3"
139+
plrust_release_checksum: sha256:e38878c6bed3870edee0c1238de1eaf90f572ddbcb67bf8a577c0ce0a5e70864
139140
plrust_language_version: "1.70.0"
141+
plrust_pgrx_version: "0.9.7"

0 commit comments

Comments
 (0)