Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
23 lines
1.7 KiB
Bash
Executable File
23 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build and push the image with Jib to a throwaway registry:2 container, then read it back.
|
|
source "$(dirname "$0")/lib.sh"
|
|
docker rm -f ci-demo-registry >/dev/null 2>&1 || true
|
|
docker run -d --name ci-demo-registry -p 5000:5000 registry:2 >/dev/null
|
|
for i in $(seq 1 30); do curl -sf localhost:5000/v2/ >/dev/null && break; sleep 1; done
|
|
{
|
|
banner "1. mvn -DskipTests jib:build, base image pulled from Docker Hub (non-deterministic: depends on the rate limit)"
|
|
"${MVN[@]}" -DskipTests jib:build 2>&1 | clean | grep -E 'Built and pushed|BUILD|ERROR\] (Failed|GET|\{)' | cut -c1-210 || true
|
|
banner "2. same, base image read from the runner's local Docker daemon (-Djib.from.image=docker://...)"
|
|
"${MVN[@]}" -DskipTests jib:build -Djib.from.image=docker://eclipse-temurin:25-jre 2>&1 | clean | grep -E 'Built and pushed|Container entrypoint|BUILD|ERROR' | cut -c1-200
|
|
banner "Registry catalog and tags"
|
|
curl -s localhost:5000/v2/_catalog; echo
|
|
curl -s localhost:5000/v2/gitea-actions-demo/tags/list; echo
|
|
banner "Layers in the pushed manifest"
|
|
curl -s -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' localhost:5000/v2/gitea-actions-demo/manifests/1.0.0 \
|
|
| python3 -c "import sys,json; m=json.load(sys.stdin); [print(f'{l[\"size\"]:>10} {l[\"digest\"][:19]}...') for l in m['layers']]; print('layers:', len(m['layers']))"
|
|
banner "Image config (user, ports, entrypoint)"
|
|
docker pull -q localhost:5000/gitea-actions-demo:1.0.0 >/dev/null
|
|
docker inspect localhost:5000/gitea-actions-demo:1.0.0 --format 'user={{.Config.User}} ports={{.Config.ExposedPorts}} entrypoint={{.Config.Entrypoint}}'
|
|
} 2>&1 | tee "$OUT/05-image-local-registry.txt"
|
|
docker rm -f ci-demo-registry >/dev/null 2>&1 || true
|