Spaces:
Sleeping
Sleeping
Commit
·
b3bd35a
1
Parent(s):
4cea1d8
run postgres commands as root
Browse files- Dockerfile +6 -9
Dockerfile
CHANGED
@@ -20,20 +20,17 @@ ENV SALT=mysalt
|
|
20 |
ENV ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
|
21 |
ENV NEXTAUTH_URL=http://localhost:3000
|
22 |
|
23 |
-
#
|
24 |
COPY <<EOF /docker-entrypoint-wrapper.sh
|
25 |
#!/bin/sh
|
26 |
|
27 |
-
#
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
runuser -u postgres -- initdb -D /var/lib/postgresql/data
|
32 |
-
runuser -u postgres -- pg_ctl -D /var/lib/postgresql/data -l /var/log/postgresql/postgresql.log -o '-c listen_addresses=*' start
|
33 |
-
runuser -u postgres -- createdb -U postgres postgres || true
|
34 |
|
35 |
# Wait for PostgreSQL to be ready
|
36 |
-
until
|
37 |
echo "Waiting for PostgreSQL to be ready..."
|
38 |
sleep 1
|
39 |
done
|
|
|
20 |
ENV ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
|
21 |
ENV NEXTAUTH_URL=http://localhost:3000
|
22 |
|
23 |
+
# Simplified wrapper script running everything as root
|
24 |
COPY <<EOF /docker-entrypoint-wrapper.sh
|
25 |
#!/bin/sh
|
26 |
|
27 |
+
# Initialize PostgreSQL
|
28 |
+
initdb -D /var/lib/postgresql/data
|
29 |
+
pg_ctl -D /var/lib/postgresql/data -l /var/log/postgresql/postgresql.log -o '-c listen_addresses=*' start
|
30 |
+
createdb -U postgres postgres || true
|
|
|
|
|
|
|
31 |
|
32 |
# Wait for PostgreSQL to be ready
|
33 |
+
until pg_isready; do
|
34 |
echo "Waiting for PostgreSQL to be ready..."
|
35 |
sleep 1
|
36 |
done
|