File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,8 @@ FROM percona/percona-postgresql-operator:2.6.0-ppg16.8-postgres
33# Switch to root user temporarily to gain necessary privileges for setup
44USER root
55
6- # Install gosu for stepping down from root
7- RUN apt-get update && apt-get install -y --no-install-recommends gosu \
8- && rm -rf /var/lib/apt/lists/* \
9- && apt-get clean
10-
11- # Create a custom entrypoint script that sets OOM score and starts postgres
12- COPY entrypoint-wrapper.sh /usr/local/bin/
136COPY postgres-oom-adjuster.sh /usr/local/bin/
7+ COPY entrypoint-wrapper.sh /usr/local/bin/
148
159# We don't change the original ENTRYPOINT - we wrap around it
1610ENTRYPOINT ["/usr/local/bin/entrypoint-wrapper.sh" ]
Original file line number Diff line number Diff line change @@ -22,6 +22,14 @@ echo "Started postmaster OOM adjuster in background"
2222export PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
2323export PG_OOM_ADJUST_VALUE=0
2424
25- # Verify the original entrypoint exists
25+ # Switching to the original user and executing original entrypoint
2626echo " Switching to user $ORIGINAL_USER and executing original entrypoint: $ORIGINAL_ENTRYPOINT $@ "
27- exec gosu $ORIGINAL_USER " $ORIGINAL_ENTRYPOINT " " $@ "
27+
28+ # Check which user-switching command is available
29+ if command -v runuser > /dev/null 2>&1 ; then
30+ # Use runuser (available on RHEL/CentOS/Fedora)
31+ exec runuser -u " #$ORIGINAL_USER " -- " $ORIGINAL_ENTRYPOINT " " $@ "
32+ else
33+ # Fall back to su
34+ exec su -s /bin/bash $ORIGINAL_USER -c " $ORIGINAL_ENTRYPOINT $* "
35+ fi
You can’t perform that action at this time.
0 commit comments