This Source-to-Image Builder let’s you create projects targetting Java OpenJDK 8 and/or OracleJDK 8, based on Red Hat’s OpenJDK Image for Java Applications
It’s just a baseline for those of you which need (for some reason) to create your own Java S2I image and want to begin from Red Hat’s supported images.
Note for purists: I know that Oracle image has a bigger size and it’s a waste of disk to install OracleJDK on top of openjdk18-openshift image, BUT what I try here is to keep the image as much supported as I can so quality, troubleshooting and supportability in the future aren’t difficult. For other good S2I image you can use Jorge Morales' image.
-
First load all the needed resources in a project:
oc apply -f https://raw.githubusercontent.com/soukron/s2i-java-openshift/master/openshift/resources/s2i-java-openshift.json
-
Then build the images for the first time:
oc start-build s2i-openjdk18-openshift oc start-build s2i-oraclejdk8-openshift
-
Once the builder s2i-openjdk18-openshift and/or s2i-oraclejdk8-openshift have been registered and built, you can create an app by using the builder images using a regular Git repository.
Run undertow sample application using new custom OpenJDK S2I image:
oc new-app --name undertow \ --context-dir undertow-servlet \ --image-stream=s2i-openjdk18-openshift \ https://github.com/jboss-openshift/openshift-quickstarts
Run undertow sample application using new custom OracleJDK S2I image:
oc new-app --name undertow \ --context-dir undertow-servlet \ --image-stream=s2i-oraclejdk8-openshift \ https://github.com/jboss-openshift/openshift-quickstarts
-
In order to build this images you need a valid Red Hat subscription entitlement to access the repositories and install software.
-
Don’t forget also Oracle’s license agreement or devil will come to you.