From 4603177ae330d135dea953b42aec28fe1eef514e Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Wed, 8 Oct 2014 20:55:25 -0700 Subject: [PATCH] Add support for /docker-entrypoint-initdb.d/ --- 8.4/docker-entrypoint.sh | 6 ++++++ 9.0/docker-entrypoint.sh | 6 ++++++ 9.1/docker-entrypoint.sh | 6 ++++++ 9.2/docker-entrypoint.sh | 6 ++++++ 9.3/docker-entrypoint.sh | 6 ++++++ 9.4/docker-entrypoint.sh | 6 ++++++ docker-entrypoint.sh | 6 ++++++ 7 files changed, 42 insertions(+) diff --git a/8.4/docker-entrypoint.sh b/8.4/docker-entrypoint.sh index 5868bad075..8011908aca 100755 --- a/8.4/docker-entrypoint.sh +++ b/8.4/docker-entrypoint.sh @@ -10,6 +10,12 @@ if [ "$1" = 'postgres' ]; then sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + + if [ -d /docker-entrypoint-initdb.d ]; then + for f in /docker-entrypoint-initdb.d/*.sh; do + [ -f "$f" ] && . "$f" + done + fi fi exec gosu postgres "$@" diff --git a/9.0/docker-entrypoint.sh b/9.0/docker-entrypoint.sh index 5868bad075..8011908aca 100755 --- a/9.0/docker-entrypoint.sh +++ b/9.0/docker-entrypoint.sh @@ -10,6 +10,12 @@ if [ "$1" = 'postgres' ]; then sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + + if [ -d /docker-entrypoint-initdb.d ]; then + for f in /docker-entrypoint-initdb.d/*.sh; do + [ -f "$f" ] && . "$f" + done + fi fi exec gosu postgres "$@" diff --git a/9.1/docker-entrypoint.sh b/9.1/docker-entrypoint.sh index 5868bad075..8011908aca 100755 --- a/9.1/docker-entrypoint.sh +++ b/9.1/docker-entrypoint.sh @@ -10,6 +10,12 @@ if [ "$1" = 'postgres' ]; then sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + + if [ -d /docker-entrypoint-initdb.d ]; then + for f in /docker-entrypoint-initdb.d/*.sh; do + [ -f "$f" ] && . "$f" + done + fi fi exec gosu postgres "$@" diff --git a/9.2/docker-entrypoint.sh b/9.2/docker-entrypoint.sh index 5868bad075..8011908aca 100755 --- a/9.2/docker-entrypoint.sh +++ b/9.2/docker-entrypoint.sh @@ -10,6 +10,12 @@ if [ "$1" = 'postgres' ]; then sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + + if [ -d /docker-entrypoint-initdb.d ]; then + for f in /docker-entrypoint-initdb.d/*.sh; do + [ -f "$f" ] && . "$f" + done + fi fi exec gosu postgres "$@" diff --git a/9.3/docker-entrypoint.sh b/9.3/docker-entrypoint.sh index 5868bad075..8011908aca 100755 --- a/9.3/docker-entrypoint.sh +++ b/9.3/docker-entrypoint.sh @@ -10,6 +10,12 @@ if [ "$1" = 'postgres' ]; then sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + + if [ -d /docker-entrypoint-initdb.d ]; then + for f in /docker-entrypoint-initdb.d/*.sh; do + [ -f "$f" ] && . "$f" + done + fi fi exec gosu postgres "$@" diff --git a/9.4/docker-entrypoint.sh b/9.4/docker-entrypoint.sh index 5868bad075..8011908aca 100755 --- a/9.4/docker-entrypoint.sh +++ b/9.4/docker-entrypoint.sh @@ -10,6 +10,12 @@ if [ "$1" = 'postgres' ]; then sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + + if [ -d /docker-entrypoint-initdb.d ]; then + for f in /docker-entrypoint-initdb.d/*.sh; do + [ -f "$f" ] && . "$f" + done + fi fi exec gosu postgres "$@" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 5868bad075..8011908aca 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -10,6 +10,12 @@ if [ "$1" = 'postgres' ]; then sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + + if [ -d /docker-entrypoint-initdb.d ]; then + for f in /docker-entrypoint-initdb.d/*.sh; do + [ -f "$f" ] && . "$f" + done + fi fi exec gosu postgres "$@"