From 9c805e176d1fef55f0d9b1503dc9748ec93f94cf Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Wed, 16 Dec 2020 08:41:17 +0100
Subject: [PATCH] First commit

---
 Dockerfile | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Dockerfile

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..f2e6af83
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,67 @@
+# the first stage of our build will use a maven 3.6 parent image
+FROM maven:3.6-openjdk-11 AS MAVEN_BUILD
+ 
+# copy the pom and src code to the container
+COPY ./ ./
+ 
+# package our application code
+RUN mvn clean install
+
+# Used this as a template: https://github.com/jboss-dockerfiles/wildfly/blob/master/Dockerfile 
+# Use latest jboss/base-jdk:11 image as the base
+FROM jboss/base-jdk:11
+
+
+# Set the WILDFLY_VERSION env variable
+ENV WILDFLY_VERSION 20.0.0.Final
+ENV WILDFLY_SHA1 3cab3453c9270c662766417adf16c27806124361
+ENV JBOSS_HOME /opt/jboss/wildfly
+
+USER root
+
+# Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content
+# Make sure the distribution is available from a well-known place
+RUN cd $HOME \
+    && curl -O https://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz \
+    && sha1sum wildfly-$WILDFLY_VERSION.tar.gz | grep $WILDFLY_SHA1 \
+    && tar xf wildfly-$WILDFLY_VERSION.tar.gz \
+    && mv $HOME/wildfly-$WILDFLY_VERSION $JBOSS_HOME \
+    && rm wildfly-$WILDFLY_VERSION.tar.gz \
+    && chown -R jboss:0 ${JBOSS_HOME} \
+    && chmod -R g+rw ${JBOSS_HOME}
+
+# copy only the artifacts we need from the first stage and discard the rest
+COPY --from=MAVEN_BUILD /target/VIPSLogic-1.0-SNAPSHOT.war /VIPSLogic-1.0-SNAPSHOT.war
+# Use the sample wildfly_config/standalone.xml, add the correct configs, and copy to the parent folder of the 
+# VIPSLogic source folder
+COPY  ../standalone.xml ${JBOSS_HOME}/standalone/configuration/standalone.xml
+#TODO Download and install the required modules
+# PostgreSQL and PostGIS jdbc drivers
+RUN mkdir -p ${JBOSS_HOME}/modules/org/postgresql/main
+RUN echo '<?xml version="1.0" encoding="UTF-8"?>\
+<module xmlns="urn:jboss:module:1.0" name="org.postgresql">\
+    <resources>\
+        <resource-root path="postgresql-42.2.18.jar"/>\
+        <resource-root path="postgis-jdbc-2.1.0.jar"/>\
+    </resources>\
+    <dependencies>\
+        <module name="javax.api"/>\
+        <module name="javax.transaction.api"/>\
+    </dependencies>\
+</module>' > ${JBOSS_HOME}/modules/org/postgresql/module.xml
+
+
+RUN ln -s /VIPSLogic-1.0-SNAPSHOT.war ${JBOSS_HOME}/standalone/deployments/VIPSLogic-1.0-SNAPSHOT.war
+
+# Ensure signals are forwarded to the JVM process correctly for graceful shutdown
+ENV LAUNCH_JBOSS_IN_BACKGROUND true
+
+USER jboss
+
+# Expose the ports we're interested in
+EXPOSE 8080
+
+# Set the default command to run on boot
+# This will boot WildFly in the standalone mode and bind to all interface
+CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]
+
-- 
GitLab