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" ]