diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3b85b2f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem + - package-ecosystem: "maven" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + ignore: + # Ignore Maven APIs/SPIs. + - dependency-name: org.apache.maven:* + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/justfile b/justfile index b78a8f2..1c2ba13 100644 --- a/justfile +++ b/justfile @@ -78,7 +78,7 @@ dependencies: [group("docker")] docker-image-create: @echo "Creating a docker image ..." - @./create_image.sh + @./tools/create_image.sh # size of the docker image (requires Docker) [group("docker")] @@ -89,7 +89,7 @@ docker-image-size: [group("docker")] docker-image-run: @echo "Running container from docker image ..." - @./start_container.sh + @./tools/start_container.sh # generate Java documentation [group("development")] diff --git a/create_image.sh b/tools/create_image.sh similarity index 75% rename from create_image.sh rename to tools/create_image.sh index be09f40..be11d48 100755 --- a/create_image.sh +++ b/tools/create_image.sh @@ -1,15 +1,19 @@ #!/usr/bin/env bash +# shellcheck disable=SC2155 # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ # `-u`: Errors if a variable is referenced before being set # `-o pipefail`: Prevent errors in a pipeline (`|`) from being masked set -uo pipefail +declare -r SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +declare -r PROJECT_DIR=$(readlink -f "$SCRIPT_DIR/..") + # Import environment variables from .env -set -o allexport && source .env && set +o allexport +set -o allexport && source "$PROJECT_DIR/.env" && set +o allexport # Check requirements -if ! command -v docker &> /dev/null; then +if ! command -v docker &>/dev/null; then echo "ERROR: 'docker' command not available. Is Docker installed?" exit 1 fi @@ -23,4 +27,6 @@ echo "Building image '$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG'..." declare -r DOCKER_OPTIONS="--platform linux/amd64" # Use BuildKit, i.e. `buildx build` instead of just `build` # https://docs.docker.com/build/ +# +# shellcheck disable=SC2086 docker buildx build $DOCKER_OPTIONS -t "$DOCKER_IMAGE_NAME":"$DOCKER_IMAGE_TAG" . diff --git a/start_container.sh b/tools/start_container.sh similarity index 82% rename from start_container.sh rename to tools/start_container.sh index 4454eea..75f4065 100755 --- a/start_container.sh +++ b/tools/start_container.sh @@ -1,18 +1,16 @@ #!/usr/bin/env bash +# shellcheck disable=SC2155 # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ # `-u`: Errors if a variable is referenced before being set # `-o pipefail`: Prevent errors in a pipeline (`|`) from being masked set -uo pipefail -# Import environment variables from .env -set -o allexport && source .env && set +o allexport +declare -r SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +declare -r PROJECT_DIR=$(readlink -f "$SCRIPT_DIR/..") -# shellcheck disable=SC2155 -declare -r OS="$(uname -s)" -# "arm64" for Apple Silicon (M1/M2/M3/etc.) -# shellcheck disable=SC2155 -declare -r ARCH="$(uname -m)" +# Import environment variables from .env +set -o allexport && source "$PROJECT_DIR/.env" && set +o allexport # Check requirements if ! command -v docker &>/dev/null; then @@ -20,6 +18,12 @@ if ! command -v docker &>/dev/null; then exit 1 fi +# shellcheck disable=SC2155 +declare -r OS="$(uname -s)" +# "arm64" for Apple Silicon (M1/M2/M3/etc.) +# shellcheck disable=SC2155 +declare -r ARCH="$(uname -m)" + DOCKER_OPTIONS="" if [[ "$OS" = "Darwin" && "$ARCH" = "arm64" ]]; then # Force amd64 as the platform. This workaround is needed on Apple Silicon @@ -30,4 +34,5 @@ fi echo "Starting container for image '$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG', exposing port ${APP_PORT}/tcp" echo "- Run 'curl http://localhost:${APP_PORT}/welcome' to send a test request to the containerized app." echo "- Enter Ctrl-C to stop the container." +# shellcheck disable=SC2086 docker run $DOCKER_OPTIONS -p "$APP_PORT:$APP_PORT" "$DOCKER_IMAGE_NAME":"$DOCKER_IMAGE_TAG"