Skip to content
Snippets Groups Projects
Commit c2cb0647 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Dockerfile now builds

parent 4b13f80b
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# this Dockerfile has to be executed from the project's parent folder, like this: # this Dockerfile has to be executed from the project's parent folder, like this:
# sudo docker build --tag vips/logic:TEST01 -f VIPSLogic/Dockerfile . # sudo docker build --tag vips/logic:TEST01 -f VIPSLogic/Dockerfile .
## Challenge: database connection to "localhost" ?? IP address? What?? :-)
# the first stage of our build will use a maven 3.6 parent image # the first stage of our build will use a maven 3.6 parent image
FROM maven:3.6-openjdk-11 AS MAVEN_BUILD FROM maven:3.6-openjdk-11 AS MAVEN_BUILD
...@@ -14,7 +13,7 @@ RUN cd VIPSCommon && mvn clean install ...@@ -14,7 +13,7 @@ RUN cd VIPSCommon && mvn clean install
# copy the pom and src code to the container # copy the pom and src code to the container
COPY ./VIPSLogic ./ COPY ./VIPSLogic ./
# package our application code # Build our application code
RUN mvn clean install RUN mvn clean install
# Used this as a template: https://github.com/jboss-dockerfiles/wildfly/blob/master/Dockerfile # Used this as a template: https://github.com/jboss-dockerfiles/wildfly/blob/master/Dockerfile
...@@ -27,6 +26,9 @@ ENV WILDFLY_VERSION 20.0.0.Final ...@@ -27,6 +26,9 @@ ENV WILDFLY_VERSION 20.0.0.Final
ENV WILDFLY_SHA1 3cab3453c9270c662766417adf16c27806124361 ENV WILDFLY_SHA1 3cab3453c9270c662766417adf16c27806124361
ENV JBOSS_HOME /opt/jboss/wildfly ENV JBOSS_HOME /opt/jboss/wildfly
# Set the VIPSLogic version (must correspond with pom.xml)
ENV APP_VERSION=2022.1
USER root USER root
# Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content # Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content
...@@ -41,29 +43,34 @@ RUN cd $HOME \ ...@@ -41,29 +43,34 @@ RUN cd $HOME \
&& chmod -R g+rw ${JBOSS_HOME} && chmod -R g+rw ${JBOSS_HOME}
# copy only the artifacts we need from the first stage and discard the rest # 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 COPY --from=MAVEN_BUILD /target/VIPSLogic-${APP_VERSION}.war /VIPSLogic-${APP_VERSION}.war
COPY --from=MAVEN_BUILD /root/.m2 /root/.m2 COPY --from=MAVEN_BUILD /root/.m2 /root/.m2
# Use the sample wildfly_config/standalone.xml, add the correct configs, and copy to the parent folder of the # Use the sample wildfly_config/standalone.xml, add the correct configs, and copy to the parent folder of the
# VIPSLogic source folder # VIPSLogic source folder
# For e.g database setup: Remember that the Docker host's hostname is host.docker.internal on Windows and
# 172.17.0.1 if you are using default networking on Linux
COPY ./standalone.xml ${JBOSS_HOME}/standalone/configuration/standalone.xml COPY ./standalone.xml ${JBOSS_HOME}/standalone/configuration/standalone.xml
#TODO Download and install the required modules
# PostgreSQL and PostGIS jdbc drivers # PostgreSQL and PostGIS JDBC drivers
# Please note that the versions must match the ones in VIPSLogic's pom.xml.
ENV POSTGRES_VERSION=42.3.1
ENV POSTGIS_VERSION=2.5.1
RUN mkdir -p ${JBOSS_HOME}/modules/org/postgresql/main RUN mkdir -p ${JBOSS_HOME}/modules/org/postgresql/main
RUN echo '<?xml version="1.0" encoding="UTF-8"?>\ RUN echo '<?xml version="1.0" encoding="UTF-8"?>\
<module xmlns="urn:jboss:module:1.0" name="org.postgresql">\ <module xmlns="urn:jboss:module:1.0" name="org.postgresql">\
<resources>\ <resources>\
<resource-root path="postgresql-42.2.18.jar"/>\ <resource-root path="postgresql-${POSTGRES_VERSION}.jar"/>\
<resource-root path="postgis-jdbc-2.2.2.jar"/>\ <resource-root path="postgis-jdbc-${POSTGIS_VERSION}.jar"/>\
</resources>\ </resources>\
<dependencies>\ <dependencies>\
<module name="javax.api"/>\ <module name="javax.api"/>\
<module name="javax.transaction.api"/>\ <module name="javax.transaction.api"/>\
</dependencies>\ </dependencies>\
</module>' > ${JBOSS_HOME}/modules/org/postgresql/main/module.xml </module>' > ${JBOSS_HOME}/modules/org/postgresql/main/module.xml
RUN cp /root/.m2/repository/org/postgresql/postgresql/42.2.18/postgresql-42.2.18.jar ${JBOSS_HOME}/modules/org/postgresql/main RUN cp /root/.m2/repository/org/postgresql/postgresql/${POSTGRES_VERSION}/postgresql-${POSTGRES_VERSION}.jar ${JBOSS_HOME}/modules/org/postgresql/main
RUN cp /root/.m2/repository/net/postgis/postgis-jdbc/2.2.2/postgis-jdbc-2.2.2.jar ${JBOSS_HOME}/modules/org/postgresql/main RUN cp /root/.m2/repository/net/postgis/postgis-jdbc/${POSTGIS_VERSION}/postgis-jdbc-${POSTGIS_VERSION}.jar ${JBOSS_HOME}/modules/org/postgresql/main
RUN ln -s /VIPSLogic-1.0-SNAPSHOT.war ${JBOSS_HOME}/standalone/deployments/VIPSLogic-1.0-SNAPSHOT.war RUN ln -s /VIPSLogic-${APP_VERSION}.war ${JBOSS_HOME}/standalone/deployments/VIPSLogic-${APP_VERSION}.war
# Ensure signals are forwarded to the JVM process correctly for graceful shutdown # Ensure signals are forwarded to the JVM process correctly for graceful shutdown
ENV LAUNCH_JBOSS_IN_BACKGROUND true ENV LAUNCH_JBOSS_IN_BACKGROUND true
......
...@@ -71,6 +71,8 @@ in the standalone.xml file. Examples for this is available in the `wildfly_confi ...@@ -71,6 +71,8 @@ in the standalone.xml file. Examples for this is available in the `wildfly_confi
`sudo docker run --publish 18080:8080 --add-host=vipslogicdb:[YOUR_HOSTS_IP_ADDRESS] --detach --name vipslogic vips/logic:TEST01` `sudo docker run --publish 18080:8080 --add-host=vipslogicdb:[YOUR_HOSTS_IP_ADDRESS] --detach --name vipslogic vips/logic:TEST01`
`172.17.0.1` is the default IP adress for the Docker host if you are running on Linux. Change accordingly. On Mac and Windows you should be able to swap this for `host.docker.internal`.
#### Troubleshooting by logging in #### Troubleshooting by logging in
`sudo docker exec -it <containername> bash` `sudo docker exec -it <containername> bash`
......
...@@ -56,13 +56,15 @@ ...@@ -56,13 +56,15 @@
<property name="no.nibio.vips.logic.AVAILABLE_LANGUAGES" value="en,nb,zh_CN"/> <property name="no.nibio.vips.logic.AVAILABLE_LANGUAGES" value="en,nb,zh_CN"/>
<property name="no.nibio.vips.logic.DISABLE_MESSAGING_SYSTEM" value="true"/> <property name="no.nibio.vips.logic.DISABLE_MESSAGING_SYSTEM" value="true"/>
<property name="no.nibio.vips.logic.weather.VIPS_WEATHER_PROXY_BASE_URL" value="http://localhost:8080/VIPSWeatherProxy"/> <property name="no.nibio.vips.logic.weather.VIPS_WEATHER_PROXY_BASE_URL" value="http://localhost:8080/VIPSWeatherProxy"/>
<property name="no.nibio.vips.logic.weather.FIELDCLIMATE_API_USERNAME" value="nibiovips"/>
<property name="no.nibio.vips.logic.weather.FIELDCLIMATE_API_PASSWORD" value="XXXXXXXXXXXX"/>
<property name="no.nibio.vips.logic.weather.FIELDCLIMATE_API_CLIENT_ID" value="XXXXXXXXXXXXXXXX"/>
<property name="no.nibio.vips.logic.weather.FIELDCLIMATE_API_CLIENT_SECRET" value="XXXXXXXXXXXXXXXXXXXXXX"/>
<property name="no.nibio.vips.logic.weather.METNOTHREDDS_TMP_FILE_PATH" value="/home/tdeveloper/vips/projects/2017_SpotIT/Task 3.2/"/>
<property name="no.nibio.vips.logic.USER_COUNTRY_CODES" value="NO,SE,BA,LV,US,FI,LT,CH"/> <property name="no.nibio.vips.logic.USER_COUNTRY_CODES" value="NO,SE,BA,LV,US,FI,LT,CH"/>
<property name="no.nibio.vips.logic.AVAILABLE_TIMEZONES" value="Europe/Oslo,Europe/Zurich,Europe/Stockholm,Europe/Vilnius,Europe/Helsinki"/> <property name="no.nibio.vips.logic.AVAILABLE_TIMEZONES" value="Europe/Oslo,Europe/Zurich,Europe/Stockholm,Europe/Vilnius,Europe/Helsinki"/>
<property name="no.nibio.vips.logic.messaging.dist.SIMULATE_MAIL_SENDING" value="true"/>
<property name="no.nibio.vips.logic.messaging.dist.MAIL_SENDER_ADDRESS" value="noreply@foobar.com"/>
<property name="no.nibio.vips.logic.messaging.dist.SMS_SERVER" value="smsgateway.foobar.com"/>
<property name="no.nibio.vips.logic.messaging.dist.SMS_USERNAME" value="foobar"/>
<property name="no.nibio.vips.logic.messaging.dist.SMS_PASSWORD" value="foobar"/>
<property name="no.nibio.vips.logic.messaging.dist.SMS_SENDER_SRC" value="foobar"/>
<property name="no.nibio.vips.logic.messaging.dist.TRAFFIC_LOG_DIRECTORY" value="/var/log/trafficLog/"/>
</system-properties> </system-properties>
<management> <management>
<security-realms> <security-realms>
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment