This commit is contained in:
parent
754fe4ca1e
commit
ba0af62d17
|
|
@ -321,7 +321,7 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql
|
RUN mkdir -p /var/run/postgresql && chown postgres:postgres /var/run/postgresql
|
||||||
|
|
||||||
COPY supervisord.conf ./etc/
|
COPY supervisord.conf ./etc/
|
||||||
|
COPY wrapper.sh /supabase/postgres/
|
||||||
|
|
||||||
#ENTRYPOINT ["docker-entrypoint.sh"]
|
#ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ chmod=0700
|
||||||
serverurl=unix:///var/run/supervisor.sock
|
serverurl=unix:///var/run/supervisor.sock
|
||||||
|
|
||||||
[program:postgres]
|
[program:postgres]
|
||||||
command=/bin/bash -c "exec /usr/local/bin/docker-entrypoint.sh postgres -D '/var/lib/postgresql/data'"
|
command=/bin/bash /supabase/postgres/wrapper.sh
|
||||||
user=root
|
user=root
|
||||||
autorestart=true
|
autorestart=true
|
||||||
startsecs=5
|
startsecs=5
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 显式导出 supervisord 注入的环境变量(保险起见)
|
||||||
|
export POSTGRES_USER="${POSTGRES_USER:-postgres}"
|
||||||
|
export POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-}"
|
||||||
|
export POSTGRES_DB="${POSTGRES_DB:-$POSTGRES_USER}"
|
||||||
|
export PGDATA="${PGDATA:-/var/lib/postgresql/data}"
|
||||||
|
|
||||||
|
# 清除旧的 pid 文件(如果存在)
|
||||||
|
rm -f "$PGDATA/postmaster.pid"
|
||||||
|
|
||||||
|
# 执行原始 entrypoint(注意 exec,防止 wrapper.sh 占用 PID 1)
|
||||||
|
exec /usr/local/bin/docker-entrypoint.sh postgres -D "$PGDATA"
|
||||||
Loading…
Reference in New Issue