From 75348a18775e1dcaaba83bfde21c4c657bd51ddc Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 28 Oct 2021 00:16:45 +0200 Subject: [PATCH] initial --- README.md | 2 ++ entrypoint.sh | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 README.md create mode 100644 entrypoint.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..58c60d4 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# entrypoint.sh +## A basic template for docker entrypoint shell scripts diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..a9fc4d2 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +trap "echo Exiting...; exit 0" EXIT TERM + +STARTUP_COMMAND="java Xmx2G -jar app.jar" # Command that you specified in your Dockerfile as 'CMD' +BASE_DIR="/app" # Base Direcotry of your containerized app + +if [[ "$*" == "$STARTUP_COMMAND" ]]; then + + if ! [ -d "$BASE_DIR" ]; then + echo "Error: $BASE_DIR is missing. Exiting..." + exit 1 + fi + + cd "$BASE_DIR" + + echo "Starting app..." + + exec "$@" +fi + +exec "$@"