mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
19 lines
670 B
Bash
19 lines
670 B
Bash
#!/bin/bash
|
|
# Custom entrypoint for PostgreSQL that processes the init template
|
|
|
|
set -e
|
|
|
|
# If this is the first run (data directory is empty), process the template
|
|
if [ ! -f /var/lib/postgresql/data/PG_VERSION ]; then
|
|
echo "Processing PostgreSQL init template..."
|
|
|
|
# Substitute environment variables in the SQL template
|
|
envsubst < /docker-entrypoint-initdb.d/init-postgres.sql.template > /docker-entrypoint-initdb.d/init-postgres.sql
|
|
|
|
echo "Template processing complete."
|
|
else
|
|
echo "PostgreSQL data directory already exists, skipping template processing."
|
|
fi
|
|
|
|
# Execute the original PostgreSQL entrypoint
|
|
exec /usr/local/bin/docker-entrypoint.sh "$@" |