Companion code for "Dockerizing Spring Boot 4: Layered Jars, Buildpacks, Distroless and Image Size Benchmarks". Fat jar on JDK and JRE, layered jar on Debian, Alpine and distroless, jlink, the JDK 25 AOT cache, Paketo buildpacks and Jib, each measured for size on disk and pushed, rebuild delta, startup, user and shell. Also PID 1 and signal handling, the jdeps module gap, AOT cache mismatches and buildpacks memory calculation. Transcripts in docs/output/, regenerated by scripts/run-all.sh. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01C3TETMrqVUWeFkNtz3Jbo3
35 lines
1.5 KiB
Bash
35 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Regenerate every transcript under docs/output/ (about 15 minutes; startup is measured three
|
|
# times per image). Stop anything else CPU-hungry first - a parallel job skewed one startup figure
|
|
# by two seconds while this was being written.
|
|
#
|
|
# Needs: Docker, crane (github.com/google/go-containerregistry) for the size-over-the-wire numbers,
|
|
# and the base images listed in docs/01-the-variants.md. In a network-restricted build environment
|
|
# set BUILDPACKS_ARGS and JIB_ARGS - the values used for the committed output are the defaults below.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
source scripts/env.sh
|
|
export BUILDPACKS_ARGS="${BUILDPACKS_ARGS--Pcorporate-proxy,no-maven-central -Dspring-boot.build-image.pullPolicy=IF_NOT_PRESENT}"
|
|
export JIB_ARGS="${JIB_ARGS--Djib.from.image=docker://eclipse-temurin:25-jre}"
|
|
|
|
crane registry serve --address "$REGISTRY" > /tmp/registry.log 2>&1 &
|
|
REG_PID=$!
|
|
trap 'kill $REG_PID 2>/dev/null' EXIT
|
|
sleep 1
|
|
|
|
mvn -q -DskipTests package
|
|
./scripts/build-images.sh
|
|
docker build -q -f docker/Dockerfile.jlink-distroless --build-arg EXTRA_MODULES= -t sbd/docker-images:jlink-jdeps-only . > /dev/null
|
|
for v in shell-form shell-form-alpine shell-form-wrapper; do
|
|
docker build -q -f "docker/Dockerfile.$v" -t "sbd/docker-images:$v" . > /dev/null
|
|
done
|
|
|
|
./scripts/measure.sh
|
|
./scripts/measure-rebuild.sh
|
|
./scripts/demo-signals.sh
|
|
./scripts/demo-jlink-metrics.sh
|
|
./scripts/demo-aot-mismatch.sh
|
|
./scripts/demo-buildpacks-memory.sh
|
|
./scripts/demo-buildpacks-layers.sh
|
|
echo "Regenerated: $(ls docs/output | wc -l) files in docs/output/"
|