tom@748: #
tom@748: # Dockerfile for jboss wildfly application server cutomized for usage in the
tom@748: # BfS-Lada project
tom@748: #
tom@748: # Build with e.g. `docker build --force-rm=true -t koala/lada_wildfly .'
tom@748: # Run with e.g.
tom@748: # `docker run --name lada_wildfly --link lada_db:lada_db
tom@748: #            -dp 8181:8080 -p 1818:9990 koala/lada_wildfly'
tom@749: # The linked container may be created from db_schema/Dockerfile.
tom@749: #
tom@749: # The LADA-server will be available under
tom@976: # http://yourdockerhost:8181/lada-server-$LADA_VERSION
tom@748: #
tom@748: 
tom@748: FROM java:7-jdk
tom@748: MAINTAINER raimund.renkert@intevation.de
tom@748: 
tom@748: #
tom@748: # install packages
tom@748: #
tom@748: RUN apt-get update -y && \
tom@761:     apt-get install -y libpostgis-java libjts-java \
dustin@852:             maven lighttpd
tom@748: 
tom@748: #
tom@748: # Set up Wildfly
tom@748: #
tom@748: RUN mkdir /opt/jboss
tom@748: 
tom@748: RUN curl \
tom@748:     https://download.jboss.org/wildfly/8.2.1.Final/wildfly-8.2.1.Final.tar.gz \
tom@748:     | tar zx && mv wildfly-8.2.1.Final /opt/jboss/wildfly
tom@748: 
tom@748: ENV JBOSS_HOME /opt/jboss/wildfly
tom@748: 
tom@748: RUN $JBOSS_HOME/bin/add-user.sh admin secret --silent
tom@748: 
dustin@852: EXPOSE 8080 9990 80
tom@748: 
tom@748: #
tom@748: # Add LADA-server repo
tom@748: #
tom@748: ADD . /usr/src/lada-server
tom@748: WORKDIR /usr/src/lada-server
tom@748: 
tom@748: #
tom@748: # Wildfly setup specific for LADA
tom@748: #
tom@748: RUN mkdir -p $JBOSS_HOME/modules/org/postgres/main
tom@761: 
tom@888: RUN curl https://jdbc.postgresql.org/download/postgresql-9.4-1200.jdbc4.jar >\
tom@888:          $JBOSS_HOME/modules/org/postgres/main/postgresql.jar
tom@761: 
tom@748: RUN ln -s /usr/share/java/postgis-jdbc-2.1.4.jar \
tom@748:        $JBOSS_HOME/modules/org/postgres/main/
tom@748: RUN ln -s /usr/share/java/jts-1.11.jar \
tom@748:        $JBOSS_HOME/modules/system/layers/base/org/hibernate/main/
tom@763: 
tom@748: RUN curl \
tom@748:     http://www.hibernatespatial.org/repository/org/hibernate/hibernate-spatial/4.3/hibernate-spatial-4.3.jar > \
tom@748:     $JBOSS_HOME/modules/system/layers/base/org/hibernate/main/hibernate-spatial-4.3.jar
tom@748: 
tom@763: RUN ln -s $PWD/wildfly/postgres-module.xml \
tom@748:        $JBOSS_HOME/modules/org/postgres/main/module.xml
tom@763: RUN ln -fs $PWD/wildfly/hibernate-module.xml \
tom@748:        $JBOSS_HOME/modules/system/layers/base/org/hibernate/main/module.xml
tom@783: RUN ln -fs $PWD/wildfly/standalone.conf $JBOSS_HOME/bin/
tom@748: 
tom@748: RUN wildfly/execute.sh
tom@748: 
tom@748: RUN rm $JBOSS_HOME/standalone/configuration/standalone_xml_history/current/*
tom@748: 
tom@748: #
tom@748: # Build and deploy LADA-server
tom@748: #
tom@976: ENV LADA_VERSION 2.3.0
dustin@852: RUN mvn clean compile package javadoc:javadoc
tom@976: RUN mv target/lada-server-$LADA_VERSION.war $JBOSS_HOME/standalone/deployments
tom@976: RUN touch $JBOSS_HOME/standalone/deployments/lada-server-$LADA_VERSION.war.dodeploy
tom@748: 
dustin@852: ##configure lighttpd for apidoc
dustin@852: RUN sed -i 's|server.document-root        = "/var/www/html"|server.document-root        = "/usr/src/lada-server/target/site/apidocs"|' /etc/lighttpd/lighttpd.conf
dustin@852: 
dustin@852: ## Start the webserver manually, when the container is started
dustin@852: # service lighttpd start
dustin@852: 
tom@748: #
tom@748: # This will boot WildFly in the standalone mode and bind to all interface
tom@748: #
tom@748: CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", \
tom@748:      "-bmanagement=0.0.0.0"]
dustin@852: