From ae00bcc116a03416c4e9579eba4c5c665b4078a2 Mon Sep 17 00:00:00 2001
From: David Ducatel <david.ducatel@yahoo.fr>
Date: Fri, 20 Oct 2017 20:20:26 +0200
Subject: [PATCH 1/2] update build process

Using multi stage build in dockerfile
---
 Dockerfile.jetty  | 17 ++++++++++++++++-
 Dockerfile.tomcat | 15 ++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/Dockerfile.jetty b/Dockerfile.jetty
index 68f077e..93bd2a6 100644
--- a/Dockerfile.jetty
+++ b/Dockerfile.jetty
@@ -1,3 +1,16 @@
+FROM maven:3-jdk-8 AS builder
+
+RUN apt-get update && apt-get install -y --no-install-recommends graphviz fonts-wqy-zenhei && rm -rf /var/lib/apt/lists/*
+
+COPY pom.xml /app/
+COPY src /app/src/
+
+ENV MAVEN_CONFIG=/app/.m2
+WORKDIR /app
+RUN mvn package
+
+########################################################################################
+
 FROM jetty
 MAINTAINER D.Ducatel
 
@@ -5,4 +18,6 @@ RUN apt-get update && \
     apt-get install -y --no-install-recommends graphviz fonts-wqy-zenhei && \
     rm -rf /var/lib/apt/lists/*
 
-ADD target/plantuml.war /var/lib/jetty/webapps/ROOT.war
+COPY --from=builder /app/target/plantuml.war /var/lib/jetty/webapps/ROOT.war
+
+
diff --git a/Dockerfile.tomcat b/Dockerfile.tomcat
index e8bb7db..4542bec 100644
--- a/Dockerfile.tomcat
+++ b/Dockerfile.tomcat
@@ -1,3 +1,16 @@
+FROM maven:3-jdk-8 AS builder
+
+RUN apt-get update && apt-get install -y --no-install-recommends graphviz fonts-wqy-zenhei && rm -rf /var/lib/apt/lists/*
+
+COPY pom.xml /app/
+COPY src /app/src/
+
+ENV MAVEN_CONFIG=/app/.m2
+WORKDIR /app
+RUN mvn package
+
+########################################################################################
+
 FROM tomcat:9
 MAINTAINER D.Ducatel
 
@@ -6,4 +19,4 @@ RUN apt-get update && \
     rm -rf /var/lib/apt/lists/*
 
 RUN rm -rf /usr/local/tomcat/webapps/ROOT
-ADD target/plantuml.war /usr/local/tomcat/webapps/ROOT.war
+COPY --from=builder /app/target/plantuml.war /usr/local/tomcat/webapps/ROOT.war

From 88b2e80da3959ad16d9fe3a98059b8f18d7e145f Mon Sep 17 00:00:00 2001
From: David Ducatel <david.ducatel@yahoo.fr>
Date: Fri, 20 Oct 2017 20:21:16 +0200
Subject: [PATCH 2/2] Simplify build and add build of armv8 image

---
 .travis.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index ec50713..c8dcc9c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,9 +5,6 @@ sudo: required
 services:
     - docker
 
-script:
-    - mvn package
-
 after_success:
   - docker login  -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
   - if [ "$TRAVIS_BRANCH" == "master" ]; then
@@ -20,4 +17,7 @@ after_success:
     docker push plantuml/plantuml-server:jetty;
     docker push plantuml/plantuml-server:latest;
 
+    docker build -t plantuml/plantuml-server:armv8a -f Dockerfile.armv8a . ;
+    docker push plantuml/plantuml-server:armv8a;
+
     fi