Skip to content

Commit

Permalink
Create dependabot.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
miguno committed Sep 19, 2024
1 parent b8882a9 commit e002c37
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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")]
Expand Down
10 changes: 8 additions & 2 deletions create_image.sh → tools/create_image.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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" .
19 changes: 12 additions & 7 deletions start_container.sh → tools/start_container.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#!/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
echo "ERROR: 'docker' command not available. Is Docker installed?"
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
Expand All @@ -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"

0 comments on commit e002c37

Please sign in to comment.