From c01a15988a68b0656d48d5d1578e211cade2c88d Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Sun, 26 Nov 2023 09:47:57 +0100 Subject: [PATCH] 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.