File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,23 @@ RUN apt-get update && \
2222 postgresql- common \
2323 jq \
2424 build- essential \
25+ gosu \
2526 && rm - rf / var/ lib/ apt/ lists/*
2627
28+ # Create postgres user with specific UID/GID (999:999) for Kubernetes compatibility
29+ # This must be done before installing PostgreSQL packages
30+ # In Kubernetes, set fsGroup: 999 in securityContext to automatically fix volume permissions
31+ RUN if ! getent group postgres > /dev/null 2>&1; then \
32+ groupadd -r postgres --gid=999; \
33+ else \
34+ groupmod -g 999 postgres 2>/dev/null || true; \
35+ fi && \
36+ if ! getent passwd postgres > /dev/null 2>&1; then \
37+ useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
38+ else \
39+ usermod -u 999 -g postgres postgres 2>/dev/null || true; \
40+ fi
41+
2742# Add the PostgreSQL 18 repository
2843RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
2944 sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
You can’t perform that action at this time.
0 commit comments