Skip to content

Commit e010aae

Browse files
committed
Add symlink for libpq and update loader cache in Dockerfiles
1 parent 3a07d7e commit e010aae

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

circleci/images/citusupgradetester/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,23 @@ apt-get install -y --no-install-recommends --allow-downgrades \
7878
postgresql-${PG_MAJOR}-dbgsym=${pgdg_version} \
7979
postgresql-server-dev-${PG_MAJOR}=${pgdg_version} \
8080

81-
# clear apt cache
82-
rm -rf /var/lib/apt/lists/*
81+
# --------------------------------------------------------------------
82+
# libpq lives in /usr/lib/x86_64-linux-gnu, but every PostgreSQL binary
83+
# looks first in $ORIGIN/../lib (→ /usr/lib/postgresql/${PG_MAJOR}/lib).
84+
# Drop one symlink there and refresh the loader cache so initdb/psql/etc.
85+
# can start without LD_LIBRARY_PATH.
86+
# --------------------------------------------------------------------
87+
88+
# clear apt cache
89+
rm -rf /var/lib/apt/lists/* && \
90+
91+
ln -s /usr/lib/x86_64-linux-gnu/libpq.so.5 \
92+
/usr/lib/postgresql/${PG_MAJOR}/lib/libpq.so.5 && \
93+
echo "/usr/lib/x86_64-linux-gnu" > /etc/ld.so.conf.d/libpq.conf && \
94+
ldconfig
8395
EOF
8496

97+
8598
# add postgress to the path
8699
ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin/:$PATH
87100

circleci/images/extbuilder/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,22 @@ apt-get install -y --no-install-recommends --allow-downgrades \
6767
postgresql-${PG_MAJOR}-dbgsym=${pgdg_version} \
6868
postgresql-server-dev-${PG_MAJOR}=${pgdg_version}
6969

70-
# clear apt cache
71-
rm -rf /var/lib/apt/lists/*
70+
# --------------------------------------------------------------------
71+
# libpq lives in /usr/lib/x86_64-linux-gnu, but every PostgreSQL binary
72+
# looks first in $ORIGIN/../lib (→ /usr/lib/postgresql/${PG_MAJOR}/lib).
73+
# Drop one symlink there and refresh the loader cache so initdb/psql/etc.
74+
# can start without LD_LIBRARY_PATH.
75+
# --------------------------------------------------------------------
76+
77+
# clear apt cache
78+
rm -rf /var/lib/apt/lists/* && \
79+
80+
ln -s /usr/lib/x86_64-linux-gnu/libpq.so.5 \
81+
/usr/lib/postgresql/${PG_MAJOR}/lib/libpq.so.5 && \
82+
echo "/usr/lib/x86_64-linux-gnu" > /etc/ld.so.conf.d/libpq.conf && \
83+
ldconfig
7284
EOF
7385

86+
7487
USER circleci
7588
WORKDIR /home/circleci

circleci/images/exttester/Dockerfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,23 @@ apt-get install -y --no-install-recommends --allow-downgrades \
174174
postgresql-server-dev-${PG_MAJOR}=${pgdg_version} \
175175
postgresql-${PG_MAJOR}-wal2json \
176176

177+
# --------------------------------------------------------------------
178+
# libpq lives in /usr/lib/x86_64-linux-gnu, but every PostgreSQL binary
179+
# looks first in $ORIGIN/../lib (→ /usr/lib/postgresql/${PG_MAJOR}/lib).
180+
# Drop one symlink there and refresh the loader cache so initdb/psql/etc.
181+
# can start without LD_LIBRARY_PATH.
182+
# --------------------------------------------------------------------
183+
177184
# clear apt cache
178-
rm -rf /var/lib/apt/lists/*
185+
rm -rf /var/lib/apt/lists/* && \
186+
187+
ln -s /usr/lib/x86_64-linux-gnu/libpq.so.5 \
188+
/usr/lib/postgresql/${PG_MAJOR}/lib/libpq.so.5 && \
189+
echo "/usr/lib/x86_64-linux-gnu" > /etc/ld.so.conf.d/libpq.conf && \
190+
ldconfig
179191
EOF
180192

193+
181194
# add postgress to the path
182195
ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin/:$PATH
183196

circleci/images/failtester/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,23 @@ apt-get install -y --no-install-recommends --allow-downgrades \
7777
postgresql-${PG_MAJOR}-dbgsym=${pgdg_version} \
7878
postgresql-server-dev-${PG_MAJOR}=${pgdg_version} \
7979

80-
# clear apt cache
81-
rm -rf /var/lib/apt/lists/*
80+
# --------------------------------------------------------------------
81+
# libpq lives in /usr/lib/x86_64-linux-gnu, but every PostgreSQL binary
82+
# looks first in $ORIGIN/../lib (→ /usr/lib/postgresql/${PG_MAJOR}/lib).
83+
# Drop one symlink there and refresh the loader cache so initdb/psql/etc.
84+
# can start without LD_LIBRARY_PATH.
85+
# --------------------------------------------------------------------
86+
87+
# clear apt cache
88+
rm -rf /var/lib/apt/lists/* && \
89+
90+
ln -s /usr/lib/x86_64-linux-gnu/libpq.so.5 \
91+
/usr/lib/postgresql/${PG_MAJOR}/lib/libpq.so.5 && \
92+
echo "/usr/lib/x86_64-linux-gnu" > /etc/ld.so.conf.d/libpq.conf && \
93+
ldconfig
8294
EOF
8395

96+
8497
# add postgress to the path
8598
ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin/:$PATH
8699

0 commit comments

Comments
 (0)