Skip to content

Commit 7e434d1

Browse files
committed
ROX-19980 fix
1 parent 1163c59 commit 7e434d1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

image/db/rhel/Dockerfile.slim

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN curl -sSLf https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-${
3636
groupadd -g 70 postgres && \
3737
adduser postgres -u 70 -g 70 -d /var/lib/postgresql -s /bin/sh && \
3838
microdnf install \
39-
ca-certificates libicu systemd-sysv glibc-locale-source glibc-langpack-en \
39+
ca-certificates tar libicu systemd-sysv glibc-locale-source glibc-langpack-en \
4040
postgresql12-server && \
4141
# The removal of /usr/share/zoneinfo from UBI minimal images is intentional.
4242
# After building the image, the image is reduced in size as much as possible,

image/db/rhel/scripts/custom-entrypoint.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ if [ ! -d "/var/lib/postgresql/data/pgdata" ]; then
3838
echo "Renaming postgres user if necessary..."
3939
if [ -n "$POSTGRES_USER" ]; then
4040
if [ "$POSTGRES_USER" != "postgres" ]; then
41-
PGPASSWORD="$POSTGRES_PASSWORD" psql -c "ALTER USER postgres RENAME TO $POSTGRES_USER;"
41+
if [ -n "$POSTGRES_PASSWORD" ]; then
42+
PGPASSWORD="$POSTGRES_PASSWORD" psql -c "ALTER USER postgres RENAME TO $POSTGRES_USER;"
43+
elif [ -n "$POSTGRES_PASSWORD_FILE" ]; then
44+
PGPASSWORD="$(cat "$POSTGRES_PASSWORD_FILE")" psql -c "ALTER USER postgres RENAME TO $POSTGRES_USER;"
45+
fi
4246
fi
4347
fi
4448

0 commit comments

Comments
 (0)