-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
110 lines (89 loc) · 3.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#
# Dockerfile for jboss wildfly application server cutomized for usage in the
# BfS-Lada project
#
# Build with e.g. `docker build --force-rm=true -t koala/lada_wildfly .'
# Run with e.g.
# `docker run --name lada_wildfly --link lada_db:db
# -dp 8181:8080 -p 1818:9990 koala/lada_wildfly'
# The linked container may be created from db_schema/Dockerfile.
#
# The LADA-server will be available under
# http://yourdockerhost:8181/lada-server
#
FROM debian:bookworm
MAINTAINER [email protected]
#
# install packages
#
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl ca-certificates-java openjdk-17-jdk-headless libpostgis-java libjts-java \
git maven
#
# Set ENV for pacakge versions
ENV WILDFLY_VERSION 29.0.1.Final
# see wildfly pom.xml for hibernate_spatial_version
ENV HIBERNATE_VERSION 6.2.6.Final
ENV GEOLATTE_GEOM_VERSION 1.9.0
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64/
RUN echo "Building Image using WILDFLY_VERSION=${WILDFLY_VERSION}, HIBERNATE_VERSION=${HIBERNATE_VERSION}, GEOLATTE_GEOM_VERSION=${GEOLATTE_GEOM_VERSION}."
#
# Set up Wildfly
#
RUN mkdir /opt/jboss
RUN curl -Ls \
https://github.com/wildfly/wildfly/releases/download/${WILDFLY_VERSION}/wildfly-${WILDFLY_VERSION}.tar.gz\
| tar zx && mv wildfly-${WILDFLY_VERSION} /opt/jboss/wildfly
ENV JBOSS_HOME /opt/jboss/wildfly
RUN $JBOSS_HOME/bin/add-user.sh admin secret --silent
EXPOSE 8080 9990 80
#
# Wildfly setup specific for LADA
#
RUN mkdir -p $JBOSS_HOME/modules/org/postgres/main
ENV MVN_REPO https://repo1.maven.org/maven2
ENV WFLY_MODULES $JBOSS_HOME/modules/system/layers/base
ENV HIBERNATE_MODULE $WFLY_MODULES/org/hibernate/main
RUN curl -s $MVN_REPO/org/hibernate/orm/hibernate-spatial/${HIBERNATE_VERSION}/hibernate-spatial-${HIBERNATE_VERSION}.jar >\
$HIBERNATE_MODULE/hibernate-spatial.jar;
RUN curl -s $MVN_REPO/org/geolatte/geolatte-geom/${GEOLATTE_GEOM_VERSION}/geolatte-geom-${GEOLATTE_GEOM_VERSION}.jar >\
$HIBERNATE_MODULE/geolatte-geom.jar
RUN ln -s /usr/share/java/postgresql.jar \
$JBOSS_HOME/modules/org/postgres/main/
RUN ln -s /usr/share/java/postgis-jdbc.jar \
$JBOSS_HOME/modules/org/postgres/main/
RUN ln -s /usr/share/java/postgis-geometry.jar \
$JBOSS_HOME/modules/org/postgres/main/
RUN ln -s /usr/share/java/jts-core.jar \
$HIBERNATE_MODULE/jts-core.jar
ENV SRC /usr/src/lada-server
# Download dependencies before adding sources to leverage build cache
ADD pom.xml $SRC/
RUN mvn -q -f $SRC/pom.xml dependency:go-offline
#
# Add LADA-server repo
#
ADD . $SRC
WORKDIR $SRC
RUN ln -s $PWD/wildfly/postgres-module.xml \
$JBOSS_HOME/modules/org/postgres/main/module.xml
RUN ln -fs $PWD/wildfly/hibernate-module.xml \
$HIBERNATE_MODULE/module.xml
# The jdbcadapters need to know the postgres module to cope with PGeometry
RUN sed -i '/<\/dependencies>/i <module name="org.postgres"/>' \
$WFLY_MODULES/org/jboss/ironjacamar/jdbcadapters/main/module.xml
RUN ln -fs $PWD/wildfly/standalone.conf $JBOSS_HOME/bin/
RUN $JBOSS_HOME/bin/jboss-cli.sh --file=wildfly/commands.cli
#
# Build and deploy LADA-server
#
RUN mvn -q package && \
mv target/lada-server-*.war \
$JBOSS_HOME/standalone/deployments/lada-server.war && \
touch $JBOSS_HOME/standalone/deployments/lada-server.war.dodeploy
#
# 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", \
"-bmanagement=0.0.0.0"]