From c01a15988a68b0656d48d5d1578e211cade2c88d Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Sun, 26 Nov 2023 09:47:57 +0100 Subject: [PATCH 1/3] feat: add custom scripts support in entrypoint.sh --- Dockerfile | 1 + .../docker-entrypoint.d/100-execute-custom-scripts.sh | 11 ----------- georchestra-docker-scripts/docker-entrypoint.sh | 10 ++++++++++ 3 files changed, 11 insertions(+), 11 deletions(-) delete mode 100755 georchestra-docker-scripts/docker-entrypoint.d/100-execute-custom-scripts.sh diff --git a/Dockerfile b/Dockerfile index bb7eac9d1..120516373 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN unzip mapstore.war -d mapstore FROM tomcat:9-jdk11-openjdk MAINTAINER geosolutions +RUN mkdir -p /docker-entrypoint.d # Tomcat specific options ENV CATALINA_BASE "$CATALINA_HOME" ENV JAVA_OPTS="${JAVA_OPTS} -Xms512m -Xmx512m -XX:MaxPermSize=128m" diff --git a/georchestra-docker-scripts/docker-entrypoint.d/100-execute-custom-scripts.sh b/georchestra-docker-scripts/docker-entrypoint.d/100-execute-custom-scripts.sh deleted file mode 100755 index 92bbaee50..000000000 --- a/georchestra-docker-scripts/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/georchestra-docker-scripts/docker-entrypoint.sh b/georchestra-docker-scripts/docker-entrypoint.sh index 874c4ad73..842ec6ee7 100755 --- a/georchestra-docker-scripts/docker-entrypoint.sh +++ b/georchestra-docker-scripts/docker-entrypoint.sh @@ -2,6 +2,16 @@ 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}" + # Regex is needed in jetty9 images, but not alpine's ones. + cp -v "${CUSTOM_SCRIPTS_DIRECTORY}"/* "$DIR" + echo "[INFO] End moving 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. From a7eaa5a5e89ee157e58c0a1054a1fe68e4e60a39 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Mon, 27 Nov 2023 15:28:28 +0100 Subject: [PATCH 2/3] fix: update command in comment --- georchestra-docker-scripts/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/georchestra-docker-scripts/docker-entrypoint.sh b/georchestra-docker-scripts/docker-entrypoint.sh index 842ec6ee7..fe2d616fb 100755 --- a/georchestra-docker-scripts/docker-entrypoint.sh +++ b/georchestra-docker-scripts/docker-entrypoint.sh @@ -9,7 +9,7 @@ else echo "[INFO] CUSTOM_SCRIPTS_DIRECTORY env variable set to ${CUSTOM_SCRIPTS_DIRECTORY}" # Regex is needed in jetty9 images, but not alpine's ones. cp -v "${CUSTOM_SCRIPTS_DIRECTORY}"/* "$DIR" - echo "[INFO] End moving custom scripts" + echo "[INFO] End copying custom scripts" fi if [[ -d "$DIR" ]] From 07e330b738c136f29b1aa1bfd76ed4936f70d47a Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Mon, 27 Nov 2023 16:30:21 +0100 Subject: [PATCH 3/3] fix: remove comment --- georchestra-docker-scripts/docker-entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/georchestra-docker-scripts/docker-entrypoint.sh b/georchestra-docker-scripts/docker-entrypoint.sh index fe2d616fb..34ff73817 100755 --- a/georchestra-docker-scripts/docker-entrypoint.sh +++ b/georchestra-docker-scripts/docker-entrypoint.sh @@ -7,7 +7,6 @@ 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. cp -v "${CUSTOM_SCRIPTS_DIRECTORY}"/* "$DIR" echo "[INFO] End copying custom scripts" fi