Skip to content

Commit 9b4e9a3

Browse files
magnusbaeckSantoshNC68
authored andcommitted
Update Dockerfile to use fabric8/java-centos-openjdk8-jre image (#151)
When running REMReM Generate in a Docker container there's little point in using a Tomcat image (tomcat:8.0-jre8) and running the war file as the sole application in its Tomcat instance. There are also a few concrete problems in such a setup: - Because the process inside the container with pid 1 won't respond to SIGTERM signals, container shutdowns will (by default) take ten seconds and the processes will be stopped with SIGKILL, leaving no opportunity to clean anything up. - Tomcat and the application each have their own logging configurations, so introducing a common log format or rotation means extra work. By switching to fabric8/java-centos-openjdk8-jre we run the war file as a standalone application with the Tomcat that's built into Spring Boot. This commit introduces a backwards incompatible change, namely that the directory where the application looks for application.properties changes. While updating the Docker documentation we also drop references to the --expose flag since it's superfluous given the "EXPOSE 8080" instruction in the dockerfile.
1 parent 1cf7171 commit 9b4e9a3

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

service/src/main/docker/Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
FROM tomcat:8.0-jre8
1+
FROM fabric8/java-centos-openjdk8-jre:1.6.4
22
MAINTAINER Eiffel-Community
3+
EXPOSE 8080
34
ARG URL
4-
RUN echo Building RemRem-Generate image based on artifact url: ${URL}
5-
RUN ["rm", "-fr", "/usr/local/tomcat/webapps/ROOT"]
6-
ADD ${URL} /usr/local/tomcat/webapps/ROOT.war
75

8-
EXPOSE 8080
9-
CMD ["catalina.sh", "run"]
6+
# Explicitly select the file to pass to "java -jar" so that additional
7+
# jar dependencies can be added to ${JAVA_APP_DIR} without creating
8+
# ambiguity.
9+
ENV JAVA_APP_JAR ${JAVA_APP_DIR}/generate.war
10+
11+
# Disable Jolokia and jmx_exporter.
12+
ENV AB_OFF true
13+
14+
RUN echo Building RemRem-Generate image based on artifact url: ${URL}
15+
ADD --chown=jboss ${URL} ${JAVA_APP_JAR}

wiki/markdown/docker.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,25 @@ It is possible to set all Spring available properties via docker envrionment "-e
6464
## Docker flags
6565

6666

67-
<B>"--expose 8080"</B> - this Docker flag tells that containers internal port shall be exposed to outside of the Docker Host. This flag do not set which port that should be allocated outside Docker Host on the actual server/machine.
68-
69-
7067
<B>"-p 8081:8080"</B> - this Docker flag is mapping the containers external port 8081 to the internal exposed port 8080. Port 8081 will be allocated outside Docker host and user will be able to access the containers service via port 8081.
7168

7269

7370
When RemRem-Generate container is running on your local Docker host, RemRem-Generate should be reachable with address "localhost:8081/\<Rest End-Point\>" or "\<docker host ip\>:8081/\<Rest End-Point\>"
7471

7572

7673
Another option to configure RemRem-Generate is to provide the application properties file into the container, which can be made in two ways:
77-
1. Put application.properties file in Tomcat Catalina config folder in container and run RemRem-Generate:
74+
1. Put application.properties file in the container's /deployments folder and run RemRem-Generate:
7875

79-
`docker run -p 8081:8080 --expose 8080 --volume /path/to/application.properties:/usr/local/tomcat/config/application.properties remrem-generate`
76+
`docker run -p 8081:8080 --volume /path/to/application.properties:/deployments/application.properties remrem-generate`
8077

8178
2. Put application.properties file in a different folder in container and tell RemRem-Generate where the application.properties is located in the container:
8279

83-
`docker run -p 8081:8080 --expose 8080 --volume /path/to/application.properties:/tmp/application.properties -e spring.config.location=/tmp/application.properties remrem-generate`
80+
`docker run -p 8081:8080 --volume /path/to/application.properties:/tmp/application.properties -e spring.config.location=/tmp/application.properties remrem-generate`
81+
82+
If you need to pass additional flags to the JVM (like setting a custom
83+
heap size) you can include those flags in the JAVA_OPTIONS environment
84+
variable. See the documentation of the
85+
[fabric8/java-centos-openjdk8-jre][docker-image-docs] Docker image for
86+
full details.
87+
88+
[docker-image-docs]: https://hub.docker.com/r/fabric8/java-centos-openjdk8-jre

0 commit comments

Comments
 (0)