Skip to content

Commit 654d5f5

Browse files
committed
Enhance Dockerfile: Add Postgres libs and fix libpq symlink for compatibility with PG 15/16
1 parent 8072f6d commit 654d5f5

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

circleci/images/exttester/Dockerfile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ FROM buildpack-deps:bullseye
8989
# add unpriviliged user for tests
9090
RUN useradd -ms /bin/bash circleci
9191

92+
# bring in the built Postgres libs so pg_regress_multi’s LD_LIBRARY_PATH has something to find
93+
COPY --from=dev-tools-builder /build /build
94+
9295
RUN <<'EOF'
9396
# install dependencies
9497
set -eux
@@ -183,7 +186,24 @@ ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin/:$PATH
183186
# setup /var/run/postgresql for use with circleci
184187
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
185188

186-
# copy the collected files from the collection container at once into the final container
187-
COPY --from=dev-tools-collection /collect/ /
189+
# --------------------------------------------------------------------
190+
# The COPY above can white‑out /usr/lib/x86_64-linux-gnu when BuildKit
191+
# is active, removing libpq.so.* that was installed earlier. We
192+
# (re)install libpq5, recreate the helper symlink for PG ≤ 16, refresh
193+
# the loader cache, and preload the client library so Citus never
194+
# complains about symbol interposition.
195+
# --------------------------------------------------------------------
196+
ARG PG_MAJOR
197+
RUN set -eux; \
198+
# 2. Satisfy RUNPATH for PG 15/16 (harmless for ≥17)
199+
ln -sf /usr/lib/x86_64-linux-gnu/libpq.so.5 \
200+
/usr/lib/postgresql/${PG_MAJOR}/lib/libpq.so.5; \
201+
\
202+
# 3. Refresh dynamic‑linker cache
203+
echo "/usr/lib/x86_64-linux-gnu" > /etc/ld.so.conf.d/libpq.conf; \
204+
ldconfig
205+
206+
# 4. Make sure the backend and Citus load the *same* libpq object
207+
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpq.so.5
188208

189209
WORKDIR /home/circleci

0 commit comments

Comments
 (0)