annotate docker/Dockerfile.gwt-client @ 9798:e21697ba97f8 3.2.x

Add default configuration in case volume remains unused
author Tom Gottfried <tom@intevation.de>
date Wed, 15 Nov 2023 11:54:00 +0100
parents 74bbf3c5d1ec
children
rev   line source
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 # Docker file for D4E River GWT client
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2
9795
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
3 FROM centos:7 AS base
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 MAINTAINER tom@intevation.de
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5
9715
278d285a16bf Ensure needed packages are installed
Tom Gottfried <tom@intevation.de>
parents: 9687
diff changeset
6 # Necessary to run further yum-installs inside Docker container,
278d285a16bf Ensure needed packages are installed
Tom Gottfried <tom@intevation.de>
parents: 9687
diff changeset
7 # if not already part of the base image:
9732
a6c6bba0fc4b Run yum commands silently
Tom Gottfried <tom@intevation.de>
parents: 9720
diff changeset
8 RUN yum -q -y install yum-plugin-ovl && rpm --rebuilddb
9715
278d285a16bf Ensure needed packages are installed
Tom Gottfried <tom@intevation.de>
parents: 9687
diff changeset
9
9795
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
10 FROM base AS build
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 # Install prerequisites
9795
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
12 RUN yum -q -y install maven mercurial curl
9787
df61a569a289 Prevent Tomcat from logging to files
Tom Gottfried <tom@intevation.de>
parents: 9781
diff changeset
13
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 WORKDIR /opt/d4e
9776
e5b86f024141 Update repository URL
Tom Gottfried <tom@intevation.de>
parents: 9754
diff changeset
15 ENV REPO_URL https://hg.wald.intevation.org/dive4elements/
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16 ENV BRANCH 3.2.x
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 RUN hg clone -b $BRANCH $REPO_URL/framework
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18 RUN hg clone -b $BRANCH $REPO_URL/http-client
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20 RUN mvn -q -f framework/pom.xml install
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21 RUN mvn -q -f http-client/pom.xml install
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22
9741
4fabdc8ed97b Fix installing SmartGWT
Tom Gottfried <tom@intevation.de>
parents: 9732
diff changeset
23 RUN curl -sLO "https://github.com/openlayers/ol2/releases/download/release-2.11/OpenLayers-2.11.tar.gz"
9685
2dad42df79a8 Add OpenLayers in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9684
diff changeset
24
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
25 # Use latest patch release and fake version=4.1-p20141119 to work around
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26 # the actual version (which is known to work properly)
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27 # is not publicly available
9741
4fabdc8ed97b Fix installing SmartGWT
Tom Gottfried <tom@intevation.de>
parents: 9732
diff changeset
28 RUN curl -sLO https://www.smartclient.com/builds/SmartGWT/4.1p/LGPL/latest/smartgwt.jar
4fabdc8ed97b Fix installing SmartGWT
Tom Gottfried <tom@intevation.de>
parents: 9732
diff changeset
29 RUN mvn -q install:install-file -Dfile=smartgwt.jar -Dversion=4.1-p20141119 \
4fabdc8ed97b Fix installing SmartGWT
Tom Gottfried <tom@intevation.de>
parents: 9732
diff changeset
30 -DartifactId=smartgwt-lgpl -DgroupId=com.isomorphic.smartgwt.lgpl \
4fabdc8ed97b Fix installing SmartGWT
Tom Gottfried <tom@intevation.de>
parents: 9732
diff changeset
31 -Dpackaging=jar
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
32
9781
7b7a58a93864 Leverage build cache for downloading dependencies
Tom Gottfried <tom@intevation.de>
parents: 9780
diff changeset
33 # Download dependencies before adding sources to leverage build cache
7b7a58a93864 Leverage build cache for downloading dependencies
Tom Gottfried <tom@intevation.de>
parents: 9780
diff changeset
34 ADD gwt-client/pom.xml river/gwt-client/
7b7a58a93864 Leverage build cache for downloading dependencies
Tom Gottfried <tom@intevation.de>
parents: 9780
diff changeset
35 RUN mvn -q -f river/gwt-client/pom.xml dependency:go-offline
7b7a58a93864 Leverage build cache for downloading dependencies
Tom Gottfried <tom@intevation.de>
parents: 9780
diff changeset
36
9780
a517ed28f133 Do not add unused other river modules to the client image
Tom Gottfried <tom@intevation.de>
parents: 9776
diff changeset
37 ADD checkstyle.xml river/
a517ed28f133 Do not add unused other river modules to the client image
Tom Gottfried <tom@intevation.de>
parents: 9776
diff changeset
38 ADD gwt-client river/gwt-client/
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
39
9685
2dad42df79a8 Add OpenLayers in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9684
diff changeset
40 RUN tar -C river/gwt-client/src/main/webapp \
2dad42df79a8 Add OpenLayers in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9684
diff changeset
41 --exclude=OpenLayers-2.11/doc --exclude=OpenLayers-2.11/tests \
2dad42df79a8 Add OpenLayers in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9684
diff changeset
42 --exclude=OpenLayers-2.11/examples -xf OpenLayers-2.11.tar.gz
2dad42df79a8 Add OpenLayers in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9684
diff changeset
43 RUN rm OpenLayers-2.11.tar.gz
9781
7b7a58a93864 Leverage build cache for downloading dependencies
Tom Gottfried <tom@intevation.de>
parents: 9780
diff changeset
44
9795
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
45 RUN mvn -q -f river/gwt-client/pom.xml package
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
46
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
47 FROM base
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
48 RUN yum -q -y install tomcat gnu-free-sans-fonts
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
49
9796
13351afee667 Set locale in client container
Tom Gottfried <tom@intevation.de>
parents: 9795
diff changeset
50 RUN localedef -i en_US -f UTF-8 en_US.UTF-8
13351afee667 Set locale in client container
Tom Gottfried <tom@intevation.de>
parents: 9795
diff changeset
51 RUN echo "LANG=en_US.utf8" > /etc/locale.conf
13351afee667 Set locale in client container
Tom Gottfried <tom@intevation.de>
parents: 9795
diff changeset
52 ENV LANG en_US.utf8
13351afee667 Set locale in client container
Tom Gottfried <tom@intevation.de>
parents: 9795
diff changeset
53
9795
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
54 # Prevent Tomcat from logging to files
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
55 # (JRE default is logging to System.err)
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
56 RUN rm /etc/tomcat/logging.properties
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
57
9743
d1dcb8d28b0d Consider map printing in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9742
diff changeset
58 # Configure tomcat
d1dcb8d28b0d Consider map printing in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9742
diff changeset
59 RUN sed -i '/Connector port="8080"/a \URIEncoding="UTF-8"' /etc/tomcat/server.xml
9797
74bbf3c5d1ec Fixup rev. cd07130ded8d
Tom Gottfried <tom@intevation.de>
parents: 9796
diff changeset
60 RUN sed -i 's/\(Connector port="8009"\)/\1 URIEncoding="UTF-8"/' \
74bbf3c5d1ec Fixup rev. cd07130ded8d
Tom Gottfried <tom@intevation.de>
parents: 9796
diff changeset
61 /etc/tomcat/server.xml
9798
e21697ba97f8 Add default configuration in case volume remains unused
Tom Gottfried <tom@intevation.de>
parents: 9797
diff changeset
62 ENV CONFIG_DIR /opt/d4e/river/gwt-client/config
e21697ba97f8 Add default configuration in case volume remains unused
Tom Gottfried <tom@intevation.de>
parents: 9797
diff changeset
63 ADD gwt-client/config $CONFIG_DIR
e21697ba97f8 Add default configuration in case volume remains unused
Tom Gottfried <tom@intevation.de>
parents: 9797
diff changeset
64 RUN ln -sf $CONFIG_DIR/context.xml /etc/tomcat
e21697ba97f8 Add default configuration in case volume remains unused
Tom Gottfried <tom@intevation.de>
parents: 9797
diff changeset
65 VOLUME $CONFIG_DIR
9743
d1dcb8d28b0d Consider map printing in Docker setup
Tom Gottfried <tom@intevation.de>
parents: 9742
diff changeset
66
9795
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
67 # Deploy
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
68 COPY --from=build /opt/d4e/river/gwt-client/target/gwt-client-*.war \
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
69 /usr/share/tomcat/webapps/d4e-river.war
8d71363cd3bd Use multi-stage build to speedup build and shrink image
Tom Gottfried <tom@intevation.de>
parents: 9787
diff changeset
70
9742
df5c6f3ef893 Do not run tomcat as root
Tom Gottfried <tom@intevation.de>
parents: 9741
diff changeset
71 USER tomcat
df5c6f3ef893 Do not run tomcat as root
Tom Gottfried <tom@intevation.de>
parents: 9741
diff changeset
72 ADD docker/flys_user_file /usr/share/tomcat/
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
73
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
74 CMD ["/usr/libexec/tomcat/server", "start"]

http://dive4elements.wald.intevation.org