From 5dd56095ba61255180681fa4a4ced2eab446b5c5 Mon Sep 17 00:00:00 2001 From: David Ducatel Date: Fri, 28 Apr 2017 10:53:11 +0200 Subject: [PATCH] Add new docker images Add tomcat container, jetty tag and self-builded docker file --- .travis.yml | 9 ++++++++- Dockerfile | 24 ++++++++++++++++++------ Dockerfile.jetty | 8 ++++++++ Dockerfile.openshift | 20 -------------------- Dockerfile.tomcat | 8 ++++++++ Dockerfile.tomcat8 | 4 ---- README.md | 13 ++++++++----- 7 files changed, 50 insertions(+), 36 deletions(-) create mode 100644 Dockerfile.jetty delete mode 100644 Dockerfile.openshift create mode 100644 Dockerfile.tomcat delete mode 100644 Dockerfile.tomcat8 diff --git a/.travis.yml b/.travis.yml index 7b38b2f..706ae79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,13 @@ script: after_success: - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - if [ "$TRAVIS_BRANCH" == "master" ]; then - docker build -t plantuml/plantuml-server:latest . ; + + docker image build -t plantuml/plantuml-server:jetty -f Dockerfile.jetty . ; + docker image build -t plantuml/plantuml-server:tomcat -f Dockerfile.tomcat . ; + docker image tag plantuml/plantuml-server:jetty plantuml/plantuml-server:latest ; + + docker push plantuml/plantuml-server:tomcat; + docker push plantuml/plantuml-server:jetty; docker push plantuml/plantuml-server:latest; + fi diff --git a/Dockerfile b/Dockerfile index 9aa20d2..a89fb39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,20 @@ -FROM jetty -MAINTAINER D.Ducatel +FROM maven:3-jdk-8 -RUN apt-get update && \ - apt-get install -y --no-install-recommends graphviz fonts-wqy-zenhei && \ - rm -rf /var/lib/apt/lists/* +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 \ No newline at end of file +COPY pom.xml /app/ +COPY src /app/src/ + +ENV MAVEN_CONFIG=/app/.m2 +WORKDIR /app +RUN mvn package + +# chmod required to ensure any user can run the app +RUN mkdir /app/.m2 && chmod -R a+w /app +EXPOSE 8080 +ENV HOME /app + +CMD java -Djetty.contextpath=/ -jar target/dependency/jetty-runner.jar target/plantuml.war + +# To run with debugging enabled instead +#CMD java -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog -Dorg.eclipse.jetty.LEVEL=DEBUG -Djetty.contextpath=/ -jar target/dependency/jetty-runner.jar target/plantuml.war diff --git a/Dockerfile.jetty b/Dockerfile.jetty new file mode 100644 index 0000000..68f077e --- /dev/null +++ b/Dockerfile.jetty @@ -0,0 +1,8 @@ +FROM jetty +MAINTAINER D.Ducatel + +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 diff --git a/Dockerfile.openshift b/Dockerfile.openshift deleted file mode 100644 index a89fb39..0000000 --- a/Dockerfile.openshift +++ /dev/null @@ -1,20 +0,0 @@ -FROM maven:3-jdk-8 - -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 - -# chmod required to ensure any user can run the app -RUN mkdir /app/.m2 && chmod -R a+w /app -EXPOSE 8080 -ENV HOME /app - -CMD java -Djetty.contextpath=/ -jar target/dependency/jetty-runner.jar target/plantuml.war - -# To run with debugging enabled instead -#CMD java -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog -Dorg.eclipse.jetty.LEVEL=DEBUG -Djetty.contextpath=/ -jar target/dependency/jetty-runner.jar target/plantuml.war diff --git a/Dockerfile.tomcat b/Dockerfile.tomcat new file mode 100644 index 0000000..877c317 --- /dev/null +++ b/Dockerfile.tomcat @@ -0,0 +1,8 @@ +FROM tomcat:9 +MAINTAINER D.Ducatel + +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 /usr/local/tomcat/webapps/ROOT.war diff --git a/Dockerfile.tomcat8 b/Dockerfile.tomcat8 deleted file mode 100644 index 0911bd8..0000000 --- a/Dockerfile.tomcat8 +++ /dev/null @@ -1,4 +0,0 @@ -# Dockerfile -FROM tomcat:8 -RUN apt-get update && apt-get install -y --no-install-recommends graphviz fonts-wqy-zenhei && rm -rf /var/lib/apt/lists/* -ADD target/*.war /usr/local/tomcat/webapps/ \ No newline at end of file diff --git a/README.md b/README.md index 33b99c5..abb3ca9 100644 --- a/README.md +++ b/README.md @@ -36,22 +36,25 @@ mvn jetty:run -Djetty.port=9999" How to run the server with Docker ================================= +You can run Plantuml with jetty or tomcat container ``` -docker run -d -p 8080:8080 plantuml/plantuml-server +docker run -d -p 8080:8080 plantuml/plantuml-server:jetty +docker run -d -p 8080:8080 plantuml/plantuml-server:tomcat ``` The server is now listing to [http://localhost:8080](http://localhost:8080). -Alternate: How to run the server with Tomcat + Docker? +Alternate: How to build your docker image ====================================================== -Above method uses maven to run the application. That requires internet connectivity. That is undesireable in a corporate environment with firewalls. So, you can use following command to create a self-contained docker image that will "just-work". +This method uses maven to run the application. That requires internet connectivity. +So, you can use following command to create a self-contained docker image that will "just-work". *Note: Generate the WAR (instructions further below) prior to running "docker build"* ``` -docker build -t plantuml-server:tomcat8 -f Dockerfile.tomcat8 . -docker run -d -p 8080:8080 plantuml-server:tomcat8 +docker image build -t plantuml-server . +docker run -d -p 8080:8080 plantuml-server ``` The server is now listing to [http://localhost:8080/plantuml](http://localhost:8080/plantuml).