Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom init scripts #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 3.8.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
30 changes: 30 additions & 0 deletions 3.8.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions 3.9.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
30 changes: 30 additions & 0 deletions 3.9.3/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down