chatai/wrapper.sh

15 lines
507 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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"