[PATCH 1 of 3] Use multi-stage build to speedup build and shrink image
Wald Commits
scm-commit at wald.intevation.org
Thu Nov 2 18:01:31 CET 2023
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1698932267 -3600
# Thu Nov 02 14:37:47 2023 +0100
# Branch 3.2.x
# Node ID 8d71363cd3bd973f21f9d4a6def17bd887219aa6
# Parent 47eee0be57927a7268f662f6cce14d0ed4aff390
Use multi-stage build to speedup build and shrink image
diff -r 47eee0be5792 -r 8d71363cd3bd docker/Dockerfile.gwt-client
--- a/docker/Dockerfile.gwt-client Thu Nov 02 11:20:50 2023 +0100
+++ b/docker/Dockerfile.gwt-client Thu Nov 02 14:37:47 2023 +0100
@@ -1,18 +1,15 @@
# Docker file for D4E River GWT client
-FROM centos:7
+FROM centos:7 AS base
MAINTAINER tom at intevation.de
# Necessary to run further yum-installs inside Docker container,
# if not already part of the base image:
RUN yum -q -y install yum-plugin-ovl && rpm --rebuilddb
+FROM base AS build
# Install prerequisites
-RUN yum -q -y install maven mercurial tomcat gnu-free-sans-fonts curl
-
-# Prevent Tomcat from logging to files
-# (JRE default is logging to System.err)
-RUN rm /etc/tomcat/logging.properties
+RUN yum -q -y install maven mercurial curl
WORKDIR /opt/d4e
ENV REPO_URL https://hg.wald.intevation.org/dive4elements/
@@ -45,15 +42,24 @@
--exclude=OpenLayers-2.11/examples -xf OpenLayers-2.11.tar.gz
RUN rm OpenLayers-2.11.tar.gz
-RUN mvn -q -f river/gwt-client/pom.xml package && \
- mv river/gwt-client/target/gwt-client-*.war \
- /usr/share/tomcat/webapps/d4e-river.war
+RUN mvn -q -f river/gwt-client/pom.xml package
+
+FROM base
+RUN yum -q -y install tomcat gnu-free-sans-fonts
+
+# Prevent Tomcat from logging to files
+# (JRE default is logging to System.err)
+RUN rm /etc/tomcat/logging.properties
# Configure tomcat
RUN sed -i '/Connector port="8080"/a \URIEncoding="UTF-8"' /etc/tomcat/server.xml
RUN ln -sf /opt/d4e/river/gwt-client/config/context.xml /etc/tomcat
VOLUME /opt/d4e/river/gwt-client/config
+# Deploy
+COPY --from=build /opt/d4e/river/gwt-client/target/gwt-client-*.war \
+ /usr/share/tomcat/webapps/d4e-river.war
+
USER tomcat
ADD docker/flys_user_file /usr/share/tomcat/
More information about the Dive4Elements-commits
mailing list