@@ -825,11 +825,11 @@ RUN case "${PG_VERSION}" in "v17") \
825
825
826
826
# ########################################################################################
827
827
#
828
- # Layer "rust extensions "
829
- # This layer is used to build `pgrx` deps
828
+ # Layer "pg build with nonroot user and cargo installed "
829
+ # This layer is base and common for layers with `pgrx`
830
830
#
831
831
# ########################################################################################
832
- FROM pg-build AS rust-extensions- build
832
+ FROM pg-build AS pg- build-nonroot-with-cargo
833
833
ARG PG_VERSION
834
834
835
835
RUN apt update && \
@@ -847,8 +847,18 @@ RUN echo -e "--retry-connrefused\n--connect-timeout 15\n--retry 5\n--max-time 30
847
847
RUN curl -sSO https://static.rust-lang.org/rustup/dist/$(uname -m)-unknown-linux-gnu/rustup-init && \
848
848
chmod +x rustup-init && \
849
849
./rustup-init -y --no-modify-path --profile minimal --default-toolchain stable && \
850
- rm rustup-init && \
851
- case "${PG_VERSION}" in \
850
+ rm rustup-init
851
+
852
+ # ########################################################################################
853
+ #
854
+ # Layer "rust extensions"
855
+ # This layer is used to build `pgrx` deps
856
+ #
857
+ # ########################################################################################
858
+ FROM pg-build-nonroot-with-cargo AS rust-extensions-build
859
+ ARG PG_VERSION
860
+
861
+ RUN case "${PG_VERSION}" in \
852
862
'v17' ) \
853
863
echo 'v17 is not supported yet by pgrx. Quit' && exit 0;; \
854
864
esac && \
@@ -867,26 +877,10 @@ USER root
867
877
# and eventually get merged with `rust-extensions-build`
868
878
#
869
879
# ########################################################################################
870
- FROM pg-build AS rust-extensions-build-pgrx12
880
+ FROM pg-build-nonroot-with-cargo AS rust-extensions-build-pgrx12
871
881
ARG PG_VERSION
872
882
873
- RUN apt update && \
874
- apt install --no-install-recommends --no-install-suggests -y curl libclang-dev && \
875
- apt clean && rm -rf /var/lib/apt/lists/* && \
876
- useradd -ms /bin/bash nonroot -b /home
877
-
878
- ENV HOME=/home/nonroot
879
- ENV PATH="/home/nonroot/.cargo/bin:$PATH"
880
- USER nonroot
881
- WORKDIR /home/nonroot
882
-
883
- RUN echo -e "--retry-connrefused\n --connect-timeout 15\n --retry 5\n --max-time 300\n " > /home/nonroot/.curlrc
884
-
885
- RUN curl -sSO https://static.rust-lang.org/rustup/dist/$(uname -m)-unknown-linux-gnu/rustup-init && \
886
- chmod +x rustup-init && \
887
- ./rustup-init -y --no-modify-path --profile minimal --default-toolchain stable && \
888
- rm rustup-init && \
889
- cargo install --locked --version 0.12.9 cargo-pgrx && \
883
+ RUN cargo install --locked --version 0.12.9 cargo-pgrx && \
890
884
/bin/bash -c 'cargo pgrx init --pg${PG_VERSION:1}=/usr/local/pgsql/bin/pg_config'
891
885
892
886
USER root
@@ -1283,7 +1277,8 @@ FROM alpine/curl:${ALPINE_CURL_VERSION} AS exporters
1283
1277
ARG TARGETARCH
1284
1278
# Keep sql_exporter version same as in build-tools.Dockerfile and
1285
1279
# test_runner/regress/test_compute_metrics.py
1286
- RUN if [ "$TARGETARCH" = "amd64" ]; then\
1280
+ RUN echo -e "--retry-connrefused\n --connect-timeout 15\n --retry 5\n --max-time 300\n " > /root/.curlrc; \
1281
+ if [ "$TARGETARCH" = "amd64" ]; then\
1287
1282
postgres_exporter_sha256='027e75dda7af621237ff8f5ac66b78a40b0093595f06768612b92b1374bd3105' ;\
1288
1283
pgbouncer_exporter_sha256='c9f7cf8dcff44f0472057e9bf52613d93f3ffbc381ad7547a959daa63c5e84ac' ;\
1289
1284
sql_exporter_sha256='38e439732bbf6e28ca4a94d7bc3686d3fa1abdb0050773d5617a9efdb9e64d08' ;\
0 commit comments