Skip to content

Commit

Permalink
Merge pull request #471 from jhuttana/phase-4
Browse files Browse the repository at this point in the history
[OPENJDK-2735] Jlink Stage 3 template
  • Loading branch information
jmtd authored Apr 5, 2024
2 parents bd80d12 + 061dd82 commit 22233e0
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions templates/multistage-dockerfile-buildconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
apiVersion: template.openshift.io/v1
kind: Template
metadata:
annotations:
description: Template to produce a light weight imagestream and buildconfig for a multistage build
name: multistage-build-template
objects:
##############################################################################
# the INPUT ImageStream (from phase 2)
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: intermediate
spec:
lookupPolicy:
local: true
tags:
- from:
kind: DockerImage
name: quay.io/jdowland/jlink:ubi9-jlinked-image
name: latest
referencePolicy:
type: Local
##############################################################################
# the ubi-micro ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: ubimicro
spec:
lookupPolicy:
local: true
tags:
- from:
kind: DockerImage
name: registry.access.redhat.com/ubi9/ubi-micro
name: latest
referencePolicy:
type: Local
##############################################################################
# the OUTPUT ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: lightweight-image
spec:
lookupPolicy:
local: false
##############################################################################
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: multistage-buildconfig
spec:
source:
images:
- from:
kind: ImageStreamTag
name: intermediate:latest
paths:
- sourcePath: /mnt/jrootfs
destinationDir: jrootfs
- sourcePath: /deployments
destinationDir: deployments
- sourcePath: /tmp/jre/.
destinationDir: customJVM
- sourcePath: /opt/jboss/container/.
destinationDir: runScripts
type: Dockerfile
dockerfile: |
FROM -
ARG JAVA_HOME=/usr/lib/jvm/java
COPY jrootfs/* /
COPY deployments /
COPY customJVM ${JAVA_HOME}
COPY runScripts /opt/jboss/container/
# these are in the micro image
RUN rm -rf /var/lib/dnf /var/lib/rpm
ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH"
USER 185
CMD /opt/jboss/container/java/run/run-java.sh
strategy:
type: Docker
dockerStrategy:
from:
kind: ImageStreamTag
name: ubimicro:latest
output:
to:
kind: ImageStreamTag
name: lightweight-image:latest # Tag for the final output image
triggers:
- type: ConfigChange
- type: ImageChange
imageChange:
from:
kind: ImageStreamTag
name: intermediate:latest # ImageStreamTag for phase-2 output
- type: ImageChange
imageChange:
from:
kind: ImageStreamTag
name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro

0 comments on commit 22233e0

Please sign in to comment.