From bb643d10be8b71c5d6f2d9a63e4b90659e26f8b6 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano Date: Thu, 31 Oct 2024 17:33:27 +0100 Subject: [PATCH] Change entrypoint --- dev-tools/build-dev-image/entrypoint.sh | 26 +++++++++++++++--------- dev-tools/build-dev-image/wzd.dockerfile | 6 +++--- 2 files changed, 19 insertions(+), 13 deletions(-) mode change 100644 => 100755 dev-tools/build-dev-image/entrypoint.sh diff --git a/dev-tools/build-dev-image/entrypoint.sh b/dev-tools/build-dev-image/entrypoint.sh old mode 100644 new mode 100755 index d00b4f7d43c9..e9102969143b --- a/dev-tools/build-dev-image/entrypoint.sh +++ b/dev-tools/build-dev-image/entrypoint.sh @@ -1,12 +1,18 @@ #!/bin/bash -base_path_plugins="/home/node/kbn/plugins" -plugins=$(ls $base_path_plugins) -for plugin in $plugins; do - if [ ! -d "$base_path_plugins/$plugin/node_modules" ]; then - cd $base_path_plugins/$plugin - echo "Installing dependencies for $plugin" - yarn install - fi -done +if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then + base_path_plugins="/home/node/kbn/plugins" + plugins=$(ls $base_path_plugins) + for plugin in $plugins; do + echo "Checking if $plugin has node_modules" + if [ ! -d "$base_path_plugins/$plugin/node_modules" ]; then + cd $base_path_plugins/$plugin + echo "Installing dependencies for $plugin" + yarn install + fi + done + cd /home/node/kbn + yarn start --no-base-path + tail -f /dev/null +fi -tail -f /dev/null +exec "$@" diff --git a/dev-tools/build-dev-image/wzd.dockerfile b/dev-tools/build-dev-image/wzd.dockerfile index c72bce71d036..8cc2065f03d1 100644 --- a/dev-tools/build-dev-image/wzd.dockerfile +++ b/dev-tools/build-dev-image/wzd.dockerfile @@ -34,8 +34,8 @@ FROM node:${NODE_VERSION} USER node COPY --chown=node:node --from=base /home/node/kbn /home/node/kbn WORKDIR /home/node/kbn -ADD ./entrypoint.sh /home/node/entrypoint.sh +ADD ./entrypoint.sh /usr/local/bin/entrypoint.sh USER root -RUN chmod +x /home/node/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh USER node -ENTRYPOINT [ "/home/node/entrypoint.sh" ] +ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]