diff --git a/web/src/docker/Dockerfile b/web/src/docker/Dockerfile index e5d405a93c..4c4c5392de 100644 --- a/web/src/docker/Dockerfile +++ b/web/src/docker/Dockerfile @@ -9,6 +9,8 @@ COPY --chown=jetty:jetty . / # Temporary switch to root USER root +RUN mkdir -p /docker-entrypoint.d +RUN chown jetty:jetty /docker-entrypoint.d RUN mkdir -p /mnt/geonetwork_datadir && \ chown jetty:jetty /mnt/geonetwork_datadir diff --git a/web/src/docker/docker-entrypoint.d/100-execute-custom-scripts.sh b/web/src/docker/docker-entrypoint.d/100-execute-custom-scripts.sh deleted file mode 100755 index 92bbaee50b..0000000000 --- a/web/src/docker/docker-entrypoint.d/100-execute-custom-scripts.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Executing custom scripts located in CUSTOM_SCRIPTS_DIRECTORY if environment variable is set -if [[ -z "${CUSTOM_SCRIPTS_DIRECTORY}" ]]; then - echo "[INFO] No CUSTOM_SCRIPTS_DIRECTORY env variable set" -else - echo "[INFO] CUSTOM_SCRIPTS_DIRECTORY env variable set to ${CUSTOM_SCRIPTS_DIRECTORY}" - # Regex is needed in jetty9 images, but not alpine's ones. - run-parts -v "${CUSTOM_SCRIPTS_DIRECTORY}" --regex='.*' - echo "[INFO] End executing custom scripts" -fi diff --git a/web/src/docker/docker-entrypoint.sh b/web/src/docker/docker-entrypoint.sh index a8ef218e94..34ff73817e 100755 --- a/web/src/docker/docker-entrypoint.sh +++ b/web/src/docker/docker-entrypoint.sh @@ -2,8 +2,18 @@ DIR=/docker-entrypoint.d +# Executing custom scripts located in CUSTOM_SCRIPTS_DIRECTORY if environment variable is set +if [[ -z "${CUSTOM_SCRIPTS_DIRECTORY}" ]]; then + echo "[INFO] No CUSTOM_SCRIPTS_DIRECTORY env variable set" +else + echo "[INFO] CUSTOM_SCRIPTS_DIRECTORY env variable set to ${CUSTOM_SCRIPTS_DIRECTORY}" + cp -v "${CUSTOM_SCRIPTS_DIRECTORY}"/* "$DIR" + echo "[INFO] End copying custom scripts" +fi + if [[ -d "$DIR" ]] then + # Regex is needed to execute all kind of files, including sh files. Warning : --regex not available in alpine images. /bin/run-parts --verbose "$DIR" --regex='.*' fi