feat: add support of maven_settings
All checks were successful
Release / release (push) Successful in 2m55s
All checks were successful
Release / release (push) Successful in 2m55s
This commit is contained in:
26
entrypoint.sh
Normal file
26
entrypoint.sh
Normal 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 "$@"
|
||||
Reference in New Issue
Block a user