Skip to content

Commit

Permalink
Implement custom scripts (#18)
Browse files Browse the repository at this point in the history
* feat: allow using startup scripts with cas datadir

georchestra/georchestra#4030

* feat: improve custom scripts to match other repos

* feat: taking account of edevos recommandations
  • Loading branch information
f-necas authored Dec 1, 2023
1 parent 537d6c9 commit 0be5077
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@ 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" ]

EXPOSE 8080

COPY --chown=jetty:jetty build/cas /var/lib/jetty/webapps/cas

COPY --chown=jetty:jetty docker/docker-entrypoint.sh /

ENV XMS=256M XMX=1G

ENTRYPOINT [ "/docker-entrypoint.sh" ]

CMD ["sh", "-c", "exec java \
-Djava.io.tmpdir=/tmp/jetty \
-Dgeorchestra.datadir=/etc/georchestra \
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

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

exec "$@"
File renamed without changes.
File renamed without changes.

0 comments on commit 0be5077

Please sign in to comment.