Skip to content

Commit 22233e0

Browse files
authored
Merge pull request #471 from jhuttana/phase-4
[OPENJDK-2735] Jlink Stage 3 template
2 parents bd80d12 + 061dd82 commit 22233e0

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
apiVersion: template.openshift.io/v1
3+
kind: Template
4+
metadata:
5+
annotations:
6+
description: Template to produce a light weight imagestream and buildconfig for a multistage build
7+
name: multistage-build-template
8+
objects:
9+
##############################################################################
10+
# the INPUT ImageStream (from phase 2)
11+
- apiVersion: image.openshift.io/v1
12+
kind: ImageStream
13+
metadata:
14+
name: intermediate
15+
spec:
16+
lookupPolicy:
17+
local: true
18+
tags:
19+
- from:
20+
kind: DockerImage
21+
name: quay.io/jdowland/jlink:ubi9-jlinked-image
22+
name: latest
23+
referencePolicy:
24+
type: Local
25+
##############################################################################
26+
# the ubi-micro ImageStream
27+
- apiVersion: image.openshift.io/v1
28+
kind: ImageStream
29+
metadata:
30+
name: ubimicro
31+
spec:
32+
lookupPolicy:
33+
local: true
34+
tags:
35+
- from:
36+
kind: DockerImage
37+
name: registry.access.redhat.com/ubi9/ubi-micro
38+
name: latest
39+
referencePolicy:
40+
type: Local
41+
##############################################################################
42+
# the OUTPUT ImageStream
43+
- apiVersion: image.openshift.io/v1
44+
kind: ImageStream
45+
metadata:
46+
name: lightweight-image
47+
spec:
48+
lookupPolicy:
49+
local: false
50+
##############################################################################
51+
- apiVersion: build.openshift.io/v1
52+
kind: BuildConfig
53+
metadata:
54+
name: multistage-buildconfig
55+
spec:
56+
source:
57+
images:
58+
- from:
59+
kind: ImageStreamTag
60+
name: intermediate:latest
61+
paths:
62+
- sourcePath: /mnt/jrootfs
63+
destinationDir: jrootfs
64+
- sourcePath: /deployments
65+
destinationDir: deployments
66+
- sourcePath: /tmp/jre/.
67+
destinationDir: customJVM
68+
- sourcePath: /opt/jboss/container/.
69+
destinationDir: runScripts
70+
type: Dockerfile
71+
dockerfile: |
72+
FROM -
73+
ARG JAVA_HOME=/usr/lib/jvm/java
74+
75+
COPY jrootfs/* /
76+
COPY deployments /
77+
COPY customJVM ${JAVA_HOME}
78+
COPY runScripts /opt/jboss/container/
79+
# these are in the micro image
80+
RUN rm -rf /var/lib/dnf /var/lib/rpm
81+
82+
ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH"
83+
USER 185
84+
CMD /opt/jboss/container/java/run/run-java.sh
85+
strategy:
86+
type: Docker
87+
dockerStrategy:
88+
from:
89+
kind: ImageStreamTag
90+
name: ubimicro:latest
91+
output:
92+
to:
93+
kind: ImageStreamTag
94+
name: lightweight-image:latest # Tag for the final output image
95+
triggers:
96+
- type: ConfigChange
97+
- type: ImageChange
98+
imageChange:
99+
from:
100+
kind: ImageStreamTag
101+
name: intermediate:latest # ImageStreamTag for phase-2 output
102+
- type: ImageChange
103+
imageChange:
104+
from:
105+
kind: ImageStreamTag
106+
name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro

0 commit comments

Comments
 (0)