Update Dockerfile
Browse files- Dockerfile +3 -2
Dockerfile
CHANGED
@@ -6,8 +6,9 @@ ENV POSTGRES_DB=mydb
|
|
6 |
ENV POSTGRES_USER=myuser
|
7 |
ENV POSTGRES_PASSWORD=mypassword
|
8 |
|
9 |
-
#
|
10 |
-
RUN
|
|
|
11 |
|
12 |
# Set the ownership of the data directory
|
13 |
RUN mkdir -p /var/lib/postgresql/data && chown -R postgres:postgres /var/lib/postgresql/data
|
|
|
6 |
ENV POSTGRES_USER=myuser
|
7 |
ENV POSTGRES_PASSWORD=mypassword
|
8 |
|
9 |
+
# Check if the postgres user and group exist, and create them if not
|
10 |
+
RUN if ! id -g postgres > /dev/null 2>&1; then groupadd -r postgres; fi
|
11 |
+
RUN if ! id -u postgres > /dev/null 2>&1; then useradd -r -g postgres postgres; fi
|
12 |
|
13 |
# Set the ownership of the data directory
|
14 |
RUN mkdir -p /var/lib/postgresql/data && chown -R postgres:postgres /var/lib/postgresql/data
|