Skip to content

Commit a31fbaf

Browse files
committed
measure.sh: script to measure image sizes
Signed-off-by: Jonathan Dowland <[email protected]>
1 parent 6b632d0 commit a31fbaf

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

measure.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# script to measure the sizes (and size savings)
2+
3+
S2I=${S2I-s2i}
4+
ENGINE=${ENGINE-docker} # or e.g. podman
5+
BASEIMG=registry.access.redhat.com/ubi9/openjdk-17:latest
6+
APPSRC=https://github.com/quarkusio/quarkus-quickstarts
7+
CONTEXTDIR=getting-started
8+
rev=3.6.6
9+
OUTIMG=out-s2i-image
10+
11+
# first build the image using shipped builder images
12+
$S2I build --pull-policy never \
13+
-e MAVEN_S2I_ARTIFACT_DIRS=target \
14+
-e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \
15+
-e QUARKUS_PACKAGE_TYPE=uber-jar \
16+
-e JAVA_APP_JAR=getting-started-1.0.0-SNAPSHOT-runner.jar \
17+
--context-dir=$CONTEXTDIR -r=${rev} \
18+
$APPSRC \
19+
$BASEIMG \
20+
$OUTIMG
21+
22+
echo "baseline (simple S2I output):"
23+
${ENGINE} inspect -f '{{.Size}}' $OUTIMG
24+
25+
# second, do a build with the image from jlink-dev branch
26+
# make sure it's been built!
27+
# NOTE: we override most variables from .s2i/environment in the quickstart
28+
# sources below, in order to an uber-jar.
29+
BASEIMG=ubi9/openjdk-17:latest
30+
OUTIMG=out-s2i-image2
31+
32+
$S2I build --pull-policy never \
33+
-e MAVEN_S2I_ARTIFACT_DIRS=target \
34+
-e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \
35+
-e QUARKUS_PACKAGE_TYPE=uber-jar \
36+
-e JAVA_APP_JAR=getting-started-1.0.0-SNAPSHOT-runner.jar \
37+
--context-dir=$CONTEXTDIR -r=${rev} \
38+
$APPSRC \
39+
$BASEIMG \
40+
$OUTIMG
41+
42+
echo "intermediate jlink image size:"
43+
docker inspect -f '{{.Size}}' $OUTIMG
44+
45+
# third, run the above thru the second-stage process
46+
OUTIMG=jlink-final
47+
${ENGINE} build -t "$OUTIMG" templates/jlink
48+
echo "final jlinked image size:"
49+
docker inspect -f '{{.Size}}' "$OUTIMG"

0 commit comments

Comments
 (0)