commit 75348a18775e1dcaaba83bfde21c4c657bd51ddc Author: Kim Date: Thu Oct 28 00:16:45 2021 +0200 initial 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 "$@"