switch to s6-rc
This commit is contained in:
parent
5103f5b01f
commit
05459d3577
@ -1,8 +1,11 @@
|
||||
FROM thallian/confd-env:latest
|
||||
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
ENV PGDATA=/var/lib/postgresql/data
|
||||
ENV S6_KEEP_ENV=1
|
||||
|
||||
RUN apk add --no-cache postgresql14 postgresql14-contrib
|
||||
RUN apk add --no-cache \
|
||||
postgresql14 \
|
||||
postgresql14-contrib
|
||||
|
||||
RUN mkdir -p /run/postgresql && mkdir -p $PGDATA
|
||||
RUN chown -R postgres /run/postgresql && chown -R postgres $PGDATA
|
||||
|
9
rootfs/bin/db-password
Executable file
9
rootfs/bin/db-password
Executable file
@ -0,0 +1,9 @@
|
||||
#!/command/with-contenv sh
|
||||
|
||||
echo "local all all trust" > "$PGDATA/pg_hba.conf"
|
||||
|
||||
pg_ctl -D "$PGDATA" -o "-c listen_addresses='localhost'" -w start
|
||||
|
||||
psql --command "ALTER USER postgres WITH PASSWORD '${POSTGRES_PASSWORD}';"
|
||||
|
||||
pg_ctl -D "$PGDATA" -o "-c listen_addresses='localhost'" -w stop
|
5
rootfs/bin/initdb
Executable file
5
rootfs/bin/initdb
Executable file
@ -0,0 +1,5 @@
|
||||
#!/command/with-contenv sh
|
||||
|
||||
if [ ! -f "/var/lib/postgresql/data/PG_VERSION" ]; then
|
||||
s6-setuidgid postgres initdb --username=postgres
|
||||
fi
|
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/with-contenv sh
|
||||
|
||||
if [ ! -f ${PGDATA}/PG_VERSION ]; then
|
||||
s6-setuidgid postgres initdb --username=postgres
|
||||
fi
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/with-contenv sh
|
||||
|
||||
cat <<EOF > /var/lib/postgresql/data/pg_hba.conf
|
||||
local all all trust
|
||||
EOF
|
||||
|
||||
s6-setuidgid postgres pg_ctl -D "$PGDATA" -o "-c listen_addresses='localhost'" -w start
|
||||
|
||||
s6-setuidgid postgres psql --command "ALTER USER postgres WITH PASSWORD '${POSTGRES_PASSWORD}';"
|
||||
|
||||
s6-setuidgid postgres pg_ctl -D "$PGDATA" -o "-c listen_addresses='localhost'" -w stop
|
@ -1 +0,0 @@
|
||||
/var/lib/postgresql true postgres 0600 0700
|
2
rootfs/etc/s6-overlay/s6-rc.d/confd/dependencies
Normal file
2
rootfs/etc/s6-overlay/s6-rc.d/confd/dependencies
Normal file
@ -0,0 +1,2 @@
|
||||
initdb
|
||||
db-password
|
1
rootfs/etc/s6-overlay/s6-rc.d/db-password/dependencies
Normal file
1
rootfs/etc/s6-overlay/s6-rc.d/db-password/dependencies
Normal file
@ -0,0 +1 @@
|
||||
initdb
|
1
rootfs/etc/s6-overlay/s6-rc.d/db-password/type
Normal file
1
rootfs/etc/s6-overlay/s6-rc.d/db-password/type
Normal file
@ -0,0 +1 @@
|
||||
oneshot
|
1
rootfs/etc/s6-overlay/s6-rc.d/db-password/up
Normal file
1
rootfs/etc/s6-overlay/s6-rc.d/db-password/up
Normal file
@ -0,0 +1 @@
|
||||
s6-setuidgid postgres db-password
|
1
rootfs/etc/s6-overlay/s6-rc.d/initdb/type
Normal file
1
rootfs/etc/s6-overlay/s6-rc.d/initdb/type
Normal file
@ -0,0 +1 @@
|
||||
oneshot
|
1
rootfs/etc/s6-overlay/s6-rc.d/initdb/up
Normal file
1
rootfs/etc/s6-overlay/s6-rc.d/initdb/up
Normal file
@ -0,0 +1 @@
|
||||
s6-setuidgid postgres initdb
|
3
rootfs/etc/s6-overlay/s6-rc.d/postgres/dependencies
Normal file
3
rootfs/etc/s6-overlay/s6-rc.d/postgres/dependencies
Normal file
@ -0,0 +1,3 @@
|
||||
initdb
|
||||
db-password
|
||||
confd
|
2
rootfs/etc/services.d/postgres/run → rootfs/etc/s6-overlay/s6-rc.d/postgres/run
Executable file → Normal file
2
rootfs/etc/services.d/postgres/run → rootfs/etc/s6-overlay/s6-rc.d/postgres/run
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/with-contenv sh
|
||||
#!/command/with-contenv sh
|
||||
|
||||
exec s6-setuidgid postgres postgres \
|
||||
-D $PGDATA \
|
1
rootfs/etc/s6-overlay/s6-rc.d/postgres/type
Normal file
1
rootfs/etc/s6-overlay/s6-rc.d/postgres/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
Loading…
Reference in New Issue
Block a user