Openshift have a different permission right because by default, any containers deployed in Openshift will gets a random user ID. Therefore it needs a specific approach when creating a containerized apps, especially in regards to folder access rights. A simple chmod or chown commands wont be sufficient enough for this purpose.
Long story short, we can use below Dockerfile to be use to deploy an existing war file into JBoss EAP base image and push the result into Openshift 4.
FROM registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8 ENV DISABLE_EMBEDDED_JMS_BROKER=true COPY target/*.war $JBOSS_HOME/standalone/deployments/ USER root RUN chgrp -R 0 $JBOSS_HOME/standalone/deployments/ && \ chmod -R g=u $JBOSS_HOME/standalone/deployments/ USER 185 EXPOSE 8080
Run below command to build the image, can use either Podman or Docker command for it.
$ podman build -t custom-app-name .
Hi. Thank you very much for your post. It’s clear how to obtain war file for instance using 2 stages build, could you clarify how to configure resources (e.x datasources and other) and setup standalone file during docker build
Hi, you can check on my repo
https://github.com/edwin/hello-world-jboss-eap
i see in project only using postgree and mysql connection, can i make that with oracle connection? thank you
Hi Fariz,
yes you can. Just add Oracle driver and connection, and you are good to go.