diff --git a/3.8.4/Dockerfile b/3.8.4/Dockerfile index 43bfd0a..6d1136c 100644 --- a/3.8.4/Dockerfile +++ b/3.8.4/Dockerfile @@ -32,6 +32,7 @@ RUN set -eux; \ netcat \ wget; \ rm -rf /var/lib/apt/lists/*; \ + mkdir /docker-entrypoint.d && \ # Verify that gosu binary works gosu nobody true diff --git a/3.8.4/docker-entrypoint.sh b/3.8.4/docker-entrypoint.sh index 03a4510..313d3ad 100755 --- a/3.8.4/docker-entrypoint.sh +++ b/3.8.4/docker-entrypoint.sh @@ -8,6 +8,36 @@ if [[ "$1" = 'zkServer.sh' && "$(id -u)" = '0' ]]; then exec gosu zookeeper "$0" "$@" fi +if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then + echo "Loading shell scripts in /docker-entrypoint.d/" + for f in $(find "/docker-entrypoint.d/" -follow -type f -print | sort -V); do + case "$f" in + *.envsh) + if [ -x "$f" ]; then + echo "Sourcing $f"; + . "$f" + else + # warn on shell scripts without exec bit + echo "Ignoring $f, not executable"; + fi + ;; + *.sh) + if [ -x "$f" ]; then + echo "Launching $f"; + "$f" + else + # warn on shell scripts without exec bit + echo "Ignoring $f, not executable"; + fi + ;; + *) echo "Ignoring $f";; + esac + done + echo "Loaded shell scripts in /docker-entrypoint.d/" +else + echo "No files found in /docker-entrypoint.d/" +fi + # Generate the config only if it doesn't exist if [[ ! -f "$ZOO_CONF_DIR/zoo.cfg" ]]; then CONFIG="$ZOO_CONF_DIR/zoo.cfg" diff --git a/3.9.3/Dockerfile b/3.9.3/Dockerfile index b14cfd7..6162456 100644 --- a/3.9.3/Dockerfile +++ b/3.9.3/Dockerfile @@ -32,6 +32,7 @@ RUN set -eux; \ netcat \ wget; \ rm -rf /var/lib/apt/lists/*; \ + mkdir /docker-entrypoint.d && \ # Verify that gosu binary works gosu nobody true diff --git a/3.9.3/docker-entrypoint.sh b/3.9.3/docker-entrypoint.sh index 03a4510..313d3ad 100755 --- a/3.9.3/docker-entrypoint.sh +++ b/3.9.3/docker-entrypoint.sh @@ -8,6 +8,36 @@ if [[ "$1" = 'zkServer.sh' && "$(id -u)" = '0' ]]; then exec gosu zookeeper "$0" "$@" fi +if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then + echo "Loading shell scripts in /docker-entrypoint.d/" + for f in $(find "/docker-entrypoint.d/" -follow -type f -print | sort -V); do + case "$f" in + *.envsh) + if [ -x "$f" ]; then + echo "Sourcing $f"; + . "$f" + else + # warn on shell scripts without exec bit + echo "Ignoring $f, not executable"; + fi + ;; + *.sh) + if [ -x "$f" ]; then + echo "Launching $f"; + "$f" + else + # warn on shell scripts without exec bit + echo "Ignoring $f, not executable"; + fi + ;; + *) echo "Ignoring $f";; + esac + done + echo "Loaded shell scripts in /docker-entrypoint.d/" +else + echo "No files found in /docker-entrypoint.d/" +fi + # Generate the config only if it doesn't exist if [[ ! -f "$ZOO_CONF_DIR/zoo.cfg" ]]; then CONFIG="$ZOO_CONF_DIR/zoo.cfg"