Skip to content

Commit 6b632d0

Browse files
authored
Merge pull request #426 from jmtd/jlink-dev-readme
README for jlink template directory
2 parents 06867b4 + 53c0347 commit 6b632d0

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

templates/jlink/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#Stage-1:build application JAR and libraries
44
#steps to build the application JAR and jlinked JRE
55
#for time being using the image built by Jon
6-
FROM quay.io/jdowland/jlink:quarkus-getting-started AS ubi9-jlinked-image
6+
FROM ubi9-jlinked-image AS ubi9-jlinked-image
77
USER 0
88
RUN mkdir -p /mnt/jrootfs
99
RUN microdnf install dnf -y

templates/jlink/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# OpenShift-JLink PoC
2+
3+
Try it out:
4+
5+
## Stage 1: build and analyse application with OpenShift source-to-image (S2I)
6+
7+
You need:
8+
9+
1. Access to an OpenShift instance, or, use [the s2i standalone program](https://github.com/openshift/source-to-image)
10+
* _([you might need to use an old version](https://github.com/openshift/source-to-image/issues/1135))_
11+
2. The OpenJDK builder image (with the customisations from the `jlink-dev` branch).
12+
There's one at `quay.io/jdowland/jlink:latest`
13+
3. A quickstart ([there's a specially-prepared Quarkus quickstart](https://github.com/jmtd/quarkus-quickstarts/tree/OPENJDK-631-fastjar-layout);
14+
in the future [the mainline Quarkus quickstarts will be suitable](https://github.com/quarkusio/quarkus-quickstarts/pull/1359))
15+
16+
Here's a recipe using local `s2i`
17+
18+
```
19+
BASEIMG=quay.io/jdowland/jlink:latest
20+
APPSRC=https://github.com/jmtd/quarkus-quickstarts.git
21+
CONTEXTDIR=getting-started
22+
REV=OPENJDK-631-fastjar-layout
23+
OUTIMG=ubi9-jlinked-image
24+
25+
s2i build --pull-policy never --context-dir=${CONTEXTDIR} -r=${REV} \
26+
-e QUARKUS_PACKAGE_TYPE=uber-jar \
27+
-e S2I_ENABLE_JLINK=true \
28+
${APPSRC} \
29+
${BASEIMG} \
30+
${OUTIMG}
31+
```
32+
33+
## Stage 2: multi-stage build to assemble micro runtime
34+
35+
You need:
36+
37+
1. The output image from the first stage
38+
* _here's one we made earlier: `quay.io/jdowland/jlink:quarkus-getting-started`_
39+
2. OpenShift, or a container runtime (e.g. Docker)
40+
3. [this Dockerfile](Dockerfile) (In future this is an OpenShift template)
41+
42+
With docker, from a clone of this repository, in this directory:
43+
44+
```
45+
docker build -t myapp -f .
46+
```
47+
48+
## Stage 3: try it out!
49+
50+
Does it work?
51+
52+
docker run --rm -ti -p 8080 myapp
53+
54+
How big is it?
55+
56+
docker inspect -f '{{.Size}}' myapp

0 commit comments

Comments
 (0)