Files
java-devops-demo/jib/scripts/lib.sh
T
Ankur MhatreandClaude Sonnet 5.5 bb12eaca0a Add jib: Spring Boot 4.2.0 images with Jib 3.5.2 vs Buildpacks
Same app built both ways: layers, reproducible digest, extraDirectories, registry push
without a daemon, wrong-JRE and missing-compile failures, Buildpacks memory calculator at
512 MB. Captured output in jib/output, regenerated by jib/scripts/run-all.sh.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
2026-12-01 08:32:09 +05:30

35 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Shared setup for the scenario scripts. Source it; do not run it.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODULE="$(cd "$HERE/.." && pwd)"
OUT="$MODULE/output"
mkdir -p "$OUT"
cd "$MODULE"
# JDK: use JAVA_HOME if the caller set it (the post was tested with Temurin 25.0.5.1+2).
export PATH="${JAVA_HOME:+$JAVA_HOME/bin:}$PATH"
# Base image source. "docker://" makes Jib read the base from the local Docker daemon instead of
# Docker Hub. The sandbox used for the post hit Docker Hub's anonymous pull limit (HTTP 429), so
# the scripts default to the daemon copy. Set JIB_BASE="" to let Jib pull eclipse-temurin:25-jre
# from the registry (Jib's default for Java 25).
JIB_BASE="${JIB_BASE-docker://eclipse-temurin:25-jre}"
BASE_ARG=()
[ -n "$JIB_BASE" ] && BASE_ARG=("-Djib.from.image=$JIB_BASE")
MVN=(mvn -B -ntp)
# Strip JVM-launcher noise and wall-clock lines that would make every rerun diff.
clean() { grep -v -E '^Picked up|^WARNING:|Finished at:|^\[INFO\] *$' ; }
banner() { printf '\n=== %s ===\n' "$*"; }
# Buildpacks arguments. In the sandbox the builder container needs the proxy and its CA (-Pcorp-proxy);
# on an open network leave PROXY_URL unset and these stay empty.
BP_ARGS=(-DskipTests -Dspring-boot.build-image.pullPolicy=IF_NOT_PRESENT)
if [ -n "${PROXY_URL:-}" ]; then
BP_ARGS+=(-Pcorp-proxy "-Dproxy.url=$PROXY_URL" "-Dca.dir=${CA_DIR:?set CA_DIR to a folder holding type + ca.crt}")
fi