feat: add support of maven_settings
All checks were successful
Release / release (push) Successful in 2m55s

This commit is contained in:
lucasdpt
2025-11-24 10:43:16 +01:00
parent 35fde410ec
commit 940ed22a60
3 changed files with 80 additions and 2 deletions

26
entrypoint.sh Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
# Entrypoint: write `MAVEN_SETTINGS` or decode `MAVEN_SETTINGS_BASE64`
# into ~/.m2/settings.xml (MAVEN_SETTINGS_BASE64 takes precedence),
# then exec the container command.
M2_DIR="${HOME:-/root}/.m2"
if [[ -n "${MAVEN_SETTINGS_BASE64:-}" ]]; then
mkdir -p "$M2_DIR"
# Decode base64 content and write it. If decoding fails the script will error.
printf '%s' "$MAVEN_SETTINGS_BASE64" | base64 -d > "$M2_DIR/settings.xml"
chmod 644 "$M2_DIR/settings.xml" || true
elif [[ -n "${MAVEN_SETTINGS:-}" ]]; then
mkdir -p "$M2_DIR"
# Write the variable contents exactly as provided
printf '%s' "$MAVEN_SETTINGS" > "$M2_DIR/settings.xml"
chmod 644 "$M2_DIR/settings.xml" || true
fi
if [[ "$#" -eq 0 ]]; then
exec "$SHELL" || exec /bin/sh
fi
exec "$@"