From d7ca967b77e1847987ffe843de33ecf2a2e223e2 Mon Sep 17 00:00:00 2001 From: "Michael G. Noll" Date: Mon, 11 Mar 2024 09:53:16 +0100 Subject: [PATCH] Print usage help on startup, use variable for app port --- start_container.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/start_container.sh b/start_container.sh index 6b653a4..f70dd92 100755 --- a/start_container.sh +++ b/start_container.sh @@ -5,9 +5,11 @@ # `-o pipefail`: Prevent errors in a pipeline (`|`) from being masked set -uo pipefail +declare -r APP_PORT=8123 + # Import environment variables from .env set -o allexport && source .env && set +o allexport - -echo "Starting container for image '$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG', exposing port 8123/tcp" -docker run -p 8123:8123 "$DOCKER_IMAGE_NAME":"$DOCKER_IMAGE_TAG" - +echo "Starting container for image '$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG', exposing port ${APP_PORT}/tcp" +echo "- Run 'curl http://localhost:${APP_PORT}/status' to send a test request to the containerized app." +echo "- Enter Ctrl-C to stop the container." +docker run -p "$APP_PORT:$APP_PORT" "$DOCKER_IMAGE_NAME":"$DOCKER_IMAGE_TAG"