mirror of
https://github.com/octoleo/plantuml-server.git
synced 2024-11-18 10:15:11 +00:00
Allow running on the Openshift platform
A few changes are necessary for the best out-of-the-box experience on Docker-based application platforms such as OpenShift: 1. For security purposes, they run the containers as non-root. Before this change, the user was trying to write to the home dir, which is set to /root by default. 2. Deploy time is limited, and the download of dependencies by Jetty at start-up time, while convenient for testing, causes timeouts when deploying. a WAR is now created during Docker image creation, and as a result starting up the container is really fast now. In addition, it is now possible to enable debug logging for Jetty by uncommenting the relevant line in the Dockerfile.
This commit is contained in:
parent
4cf9465d04
commit
163863ac0b
17
Dockerfile
17
Dockerfile
@ -1,7 +1,20 @@
|
|||||||
FROM maven:3-jdk-8
|
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 . /app
|
|
||||||
|
COPY pom.xml /app/
|
||||||
|
COPY src /app/src/
|
||||||
|
|
||||||
|
ENV MAVEN_CONFIG=/app/.m2
|
||||||
WORKDIR /app
|
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
|
EXPOSE 8080
|
||||||
CMD ["mvn", "jetty:run"]
|
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
|
||||||
|
24
pom.xml
24
pom.xml
@ -32,7 +32,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<scanIntervalSeconds>5</scanIntervalSeconds>
|
<scanIntervalSeconds>5</scanIntervalSeconds>
|
||||||
<webApp>
|
<webApp>
|
||||||
<contextPath>/plantuml</contextPath>
|
<contextPath>${jetty.contextpath}</contextPath>
|
||||||
</webApp>
|
</webApp>
|
||||||
<systemProperties>
|
<systemProperties>
|
||||||
<systemProperty>
|
<systemProperty>
|
||||||
@ -42,6 +42,27 @@
|
|||||||
</systemProperties>
|
</systemProperties>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>copy</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
|
<artifactId>jetty-runner</artifactId>
|
||||||
|
<version>8.1.9.v20130131</version>
|
||||||
|
<destFileName>jetty-runner.jar</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
@ -149,6 +170,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<jetty.version>8.0.4.v20111024</jetty.version>
|
<jetty.version>8.0.4.v20111024</jetty.version>
|
||||||
<jetty.port>8080</jetty.port>
|
<jetty.port>8080</jetty.port>
|
||||||
|
<jetty.contextpath>/plantuml</jetty.contextpath>
|
||||||
<maven.build.timestamp.format>yyyyMMdd-HHmm
|
<maven.build.timestamp.format>yyyyMMdd-HHmm
|
||||||
</maven.build.timestamp.format>
|
</maven.build.timestamp.format>
|
||||||
<timestamp>${maven.build.timestamp}</timestamp>
|
<timestamp>${maven.build.timestamp}</timestamp>
|
||||||
|
Loading…
Reference in New Issue
Block a user