FROM   registry.access.redhat.com/ubi8/ubi:8.0

MAINTAINER   Red Hat Training <training@redhat.com>

# command line options to pass to the JVM
ENV	  JAVA_OPTIONS -Xmx512m


# Install the Java runtime, create a user for running the app, and set permissions
RUN   dnf install -y --noplugins java-1.8.0-openjdk-headless && \
      dnf clean all --noplugins -y && \
      useradd wildfly && \
      mkdir -p /opt/app-root/bin

# Copy the runnable fat JAR to the container.
ADD   https://github.com/RedHatTraining/DO288-apps/releases/download/1.0/hello-swarm.jar /opt/app-root/bin/

COPY  run-app.sh /opt/app-root/bin/

RUN   chown -R wildfly:wildfly /opt/app-root && \
      chmod -R 700 /opt/app-root

EXPOSE 8080

USER  wildfly

# Run the fat JAR
CMD   /opt/app-root/bin/run-app.sh
