Apache Tomcat docker image automation build
- latest (based on openjdk:8u212-jdk-alpine3.9 image)
- 9.0.37 (based on openjdk:8u212-jdk-alpine3.9 image)
- 9.0.6 (based on openjdk:8u151-jdk-alpine image with JCE installed)
- 9.0.2 (based on openjdk:8u151-jdk-alpine image with JCE installed)
- 8.5.57 (based on openjdk:8u212-jdk-alpine3.9 image)
- 8.5.29 (based on openjdk:8u151-jdk-alpine image with JCE installed)
- 8.5.24 (based on openjdk:8u151-jdk-alpine image with JCE installed)
Exposed ports:
- 8080 - deployed web apps
create Dockerfile with next content:
FROM daggerok/apache-tomcat:8.5.57
RUN rm -rf ${TOMCAT_HOME}/webapps/ROOT*
COPY --chown=tomcat ./target/*.war ${TOMCAT_HOME}/webapps/ROOT.war
build and run application in Docker:
docker build -t daggerok/my-site .
docker run --name my-site --rm -it -p 8080:8080 daggerok/my-site
test if it's works and hosted from root context path:
curl 0:8080/
cleanup:
docker stop my-site
Assuming you have /health
in your app
:
FROM daggerok/apache-tomcat:9.0.37
HEALTHCHECK --start-period=1s \
--interval=1s \
--timeout=5s \
--retries=33 \
CMD wget -q --spider http://127.0.0.1:8080/app/health/ || exit 1
#ADD ./build/libs/*.war ${TOMCAT_HOME}/webapps/app.war
COPY --chwon=tomcat ./build/libs/*.war ${TOMCAT_HOME}/webapps/app.war
FROM daggerok/apache-tomcat:9-alpine
ARG JPDA_OPTS_ARG="${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,address=1043,server=y,suspend=n"
ENV JPDA_OPTS="${JPDA_OPTS_ARG}"
EXPOSE 5005
COPY --chwon=tomcat ./target/*.war ${TOMCAT_HOME}/webapps/
FROM daggerok/apache-tomcat:8.5.57-alpine
COPY --chwon=tomcat ./path/to/some/*.war ./path/to/another/*.war ${TOMCAT_HOME}/webapps/
FROM daggerok/apache-tomcat:8
RUN rm -rf ${TOMCAT_HOME}/webapps/{ROOT*,docs,examples,host-manager,manager}
COPY --chwon=tomcat ./path/to/some/*.war ${TOMCAT_HOME}/webapps/ROOT.war
docker run --rm --name tomcat -d -p 8080:8080 daggerok/tomcat:8.5.57