comparison docker/Dockerfile.gwt-client @ 9795:8d71363cd3bd 3.2.x

Use multi-stage build to speedup build and shrink image
author Tom Gottfried <tom@intevation.de>
date Thu, 02 Nov 2023 14:37:47 +0100
parents df61a569a289
children 13351afee667
comparison
equal deleted inserted replaced
9794:47eee0be5792 9795:8d71363cd3bd
1 # Docker file for D4E River GWT client 1 # Docker file for D4E River GWT client
2 2
3 FROM centos:7 3 FROM centos:7 AS base
4 MAINTAINER tom@intevation.de 4 MAINTAINER tom@intevation.de
5 5
6 # Necessary to run further yum-installs inside Docker container, 6 # Necessary to run further yum-installs inside Docker container,
7 # if not already part of the base image: 7 # if not already part of the base image:
8 RUN yum -q -y install yum-plugin-ovl && rpm --rebuilddb 8 RUN yum -q -y install yum-plugin-ovl && rpm --rebuilddb
9 9
10 FROM base AS build
10 # Install prerequisites 11 # Install prerequisites
11 RUN yum -q -y install maven mercurial tomcat gnu-free-sans-fonts curl 12 RUN yum -q -y install maven mercurial curl
12
13 # Prevent Tomcat from logging to files
14 # (JRE default is logging to System.err)
15 RUN rm /etc/tomcat/logging.properties
16 13
17 WORKDIR /opt/d4e 14 WORKDIR /opt/d4e
18 ENV REPO_URL https://hg.wald.intevation.org/dive4elements/ 15 ENV REPO_URL https://hg.wald.intevation.org/dive4elements/
19 ENV BRANCH 3.2.x 16 ENV BRANCH 3.2.x
20 RUN hg clone -b $BRANCH $REPO_URL/framework 17 RUN hg clone -b $BRANCH $REPO_URL/framework
43 RUN tar -C river/gwt-client/src/main/webapp \ 40 RUN tar -C river/gwt-client/src/main/webapp \
44 --exclude=OpenLayers-2.11/doc --exclude=OpenLayers-2.11/tests \ 41 --exclude=OpenLayers-2.11/doc --exclude=OpenLayers-2.11/tests \
45 --exclude=OpenLayers-2.11/examples -xf OpenLayers-2.11.tar.gz 42 --exclude=OpenLayers-2.11/examples -xf OpenLayers-2.11.tar.gz
46 RUN rm OpenLayers-2.11.tar.gz 43 RUN rm OpenLayers-2.11.tar.gz
47 44
48 RUN mvn -q -f river/gwt-client/pom.xml package && \ 45 RUN mvn -q -f river/gwt-client/pom.xml package
49 mv river/gwt-client/target/gwt-client-*.war \ 46
50 /usr/share/tomcat/webapps/d4e-river.war 47 FROM base
48 RUN yum -q -y install tomcat gnu-free-sans-fonts
49
50 # Prevent Tomcat from logging to files
51 # (JRE default is logging to System.err)
52 RUN rm /etc/tomcat/logging.properties
51 53
52 # Configure tomcat 54 # Configure tomcat
53 RUN sed -i '/Connector port="8080"/a \URIEncoding="UTF-8"' /etc/tomcat/server.xml 55 RUN sed -i '/Connector port="8080"/a \URIEncoding="UTF-8"' /etc/tomcat/server.xml
54 RUN ln -sf /opt/d4e/river/gwt-client/config/context.xml /etc/tomcat 56 RUN ln -sf /opt/d4e/river/gwt-client/config/context.xml /etc/tomcat
55 VOLUME /opt/d4e/river/gwt-client/config 57 VOLUME /opt/d4e/river/gwt-client/config
56 58
59 # Deploy
60 COPY --from=build /opt/d4e/river/gwt-client/target/gwt-client-*.war \
61 /usr/share/tomcat/webapps/d4e-river.war
62
57 USER tomcat 63 USER tomcat
58 ADD docker/flys_user_file /usr/share/tomcat/ 64 ADD docker/flys_user_file /usr/share/tomcat/
59 65
60 CMD ["/usr/libexec/tomcat/server", "start"] 66 CMD ["/usr/libexec/tomcat/server", "start"]

http://dive4elements.wald.intevation.org