Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OPENJDK-2735] Jlink Stage 3 template #471

Merged
merged 6 commits into from
Apr 5, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions templates/multistage-dockerfile-buildconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
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 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 registry.access.redhat.com/ubi9/ubi-micro
ARG JAVA_HOME=/usr/lib/jvm/java

COPY jrootfs/ /
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is putting the result at /jrootfs in the final image. We need to adjust it somehow so it unpacks over / instead.

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
output:
to:
kind: ImageStreamTag
name: lightweight-image:latest # Tag for the final output image
triggers:
- type: ConfigChange
Loading