diff --git a/Dockerfile b/Dockerfile index 9d6e418..8bc4a58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,11 @@ FROM jetty:9.4-jre11 LABEL "Organization"="geOrchestra" LABEL "Description"="CAS server webapp" +USER root +RUN mkdir -p /docker-entrypoint.d +RUN chown jetty:jetty /docker-entrypoint.d +USER jetty + RUN java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start=jmx,jmx-remote,stats,gzip,http-forwarded VOLUME [ "/tmp", "/run/jetty" ] @@ -11,7 +16,6 @@ EXPOSE 8080 COPY --chown=jetty:jetty build/cas /var/lib/jetty/webapps/cas COPY --chown=jetty:jetty docker-entrypoint.sh / -COPY --chown=jetty:jetty docker-entrypoint.d /docker-entrypoint.d/ ENV XMS=256M XMX=1G diff --git a/docker-entrypoint.d/100-execute-custom-scripts.sh b/docker-entrypoint.d/100-execute-custom-scripts.sh deleted file mode 100755 index fdcc436..0000000 --- a/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 \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 905e731..3b337df 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,6 +2,15 @@ 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.