From a1bb47054170e0aff30cfc6e0d8b91aceb4027c2 Mon Sep 17 00:00:00 2001 From: Bodo Schulz Date: Sun, 12 Dec 2021 15:43:49 +0100 Subject: [PATCH] updates: - tomcat to version 9.0.56 - jolokia to version 1.7.1 - hawtio to version 2.14.1 rebuild Dockerfile --- Dockerfile | 81 ++++++++++++++++++++++++++++++++++++++++-------------- Makefile | 6 ++-- hooks/stop | 2 -- 3 files changed, 63 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c94bbf..04d12f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM alpine:3 +FROM alpine:3 as stage1 EXPOSE 8080 22222 @@ -11,25 +11,17 @@ ARG HAWTIO_VERSION ENV \ TERM=xterm \ - CATALINA_HOME=/opt/tomcat \ - JAVA_HOME=/usr/lib/jvm/default-jvm \ - PATH=${PATH}:/opt/jdk/bin:${CATALINA_HOME}/bin - -# --------------------------------------------------------------------------------------------------------------------- + CATALINA_HOME=/opt/tomcat # hadolint ignore=SC2035,DL3003,DL3017,DL3018,DL4006 RUN \ apk update --quiet --no-cache && \ - apk upgrade --quiet --no-cache && \ apk add --quiet --no-cache \ - curl \ - nss \ - openjdk11-jre-headless \ - tomcat-native && \ - echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \ - echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \ - sed -i 's,#networkaddress.cache.ttl=-1,networkaddress.cache.ttl=30,' "${JAVA_HOME}/jre/conf/security/java.security" && \ - [ -d /opt ] || mkdir /opt 2> /dev/null && \ + curl && \ + [ -d /opt ] || mkdir /opt 2> /dev/null + +# hadolint ignore=DL4006 +RUN \ echo "download tomcat version $TOMCAT_VERSION (https://archive.apache.org/dist/tomcat/tomcat-9/)" && \ curl \ --silent \ @@ -40,8 +32,10 @@ RUN \ | gunzip \ | tar x -C /opt/ && \ ln -s "/opt/apache-tomcat-$TOMCAT_VERSION" "${CATALINA_HOME}" && \ - ln -s "${CATALINA_HOME}/logs" /var/log/jolokia && \ - rm -rf "${CATALINA_HOME}/webapps/*" && \ + rm -rf "${CATALINA_HOME}/webapps/*" + +RUN \ + ls -l "${CATALINA_HOME}" && \ echo "download jolokia version $JOLOKIA_VERSION (https://repo1.maven.org/maven2/org/jolokia/jolokia-war)" && \ curl \ --silent \ @@ -49,7 +43,10 @@ RUN \ --retry 3 \ --cacert /etc/ssl/certs/ca-certificates.crt \ --output "${CATALINA_HOME}/webapps/jolokia.war" \ - "https://repo1.maven.org/maven2/org/jolokia/jolokia-war/$JOLOKIA_VERSION/jolokia-war-$JOLOKIA_VERSION.war" && \ + "https://repo1.maven.org/maven2/org/jolokia/jolokia-war/$JOLOKIA_VERSION/jolokia-war-$JOLOKIA_VERSION.war" + +# hadolint ignore=DL3003 +RUN \ echo "download hawtio version $HAWTIO_VERSION (https://github.com/hawtio/hawtio/tags)" && \ curl \ --silent \ @@ -57,8 +54,11 @@ RUN \ --retry 3 \ --cacert /etc/ssl/certs/ca-certificates.crt \ --output "${CATALINA_HOME}/webapps/hawtio.war" \ - "https://oss.sonatype.org/content/repositories/public/io/hawt/hawtio-default/$HAWTIO_VERSION/hawtio-default-$HAWTIO_VERSION.war" && \ - cd "${CATALINA_HOME}/webapps/" && \ + "https://oss.sonatype.org/content/repositories/public/io/hawt/hawtio-default/$HAWTIO_VERSION/hawtio-default-$HAWTIO_VERSION.war" + +WORKDIR ${CATALINA_HOME}/webapps + +RUN \ mkdir \ jolokia hawtio && \ unzip jolokia.war -d jolokia > /dev/null && \ @@ -68,7 +68,45 @@ RUN \ rm -f "${CATALINA_HOME}/NOTICE" && \ rm -f "${CATALINA_HOME}/RELEASE-NOTES" && \ rm -f "${CATALINA_HOME}/RUNNING.txt" && \ - rm -f "${CATALINA_HOME}/bin/*.bat" && \ + rm -f "${CATALINA_HOME}/bin/*.bat" + +RUN \ + ls -l /opt + +# --------------------------------------------------------------------------------------------------------------------- + +FROM alpine:3 + +EXPOSE 8080 22222 + +ARG BUILD_DATE +ARG BUILD_VERSION +ARG TOMCAT_VERSION +ARG JOLOKIA_VERSION +ARG HAWTIO_VERSION + +ENV \ + TERM=xterm \ + CATALINA_HOME=/opt/tomcat \ + JAVA_HOME=/usr/lib/jvm/default-jvm \ + PATH=${PATH}:/opt/jdk/bin:${CATALINA_HOME}/bin + +# --------------------------------------------------------------------------------------------------------------------- + +# hadolint ignore=SC2035,DL3003,DL3017,DL3018,DL4006 +RUN \ + apk update --quiet --no-cache && \ + apk upgrade --quiet --no-cache && \ + apk add --quiet --no-cache \ + curl \ + nss \ + openjdk11-jre-headless \ + tomcat-native && \ + echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \ + echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \ + sed -i 's,#networkaddress.cache.ttl=-1,networkaddress.cache.ttl=30,' "${JAVA_HOME}/jre/conf/security/java.security" && \ + ln -s "/opt/apache-tomcat-$TOMCAT_VERSION" "${CATALINA_HOME}" && \ + ln -s "${CATALINA_HOME}/logs" /var/log/jolokia && \ rm -rf \ /tmp/* \ /var/cache/apk/* @@ -76,6 +114,7 @@ RUN \ WORKDIR ${CATALINA_HOME}/webapps/ COPY rootfs/ / +COPY --from=stage1 /opt /opt CMD ["/init/run.sh"] diff --git a/Makefile b/Makefile index 83ecebb..81b44fd 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,9 @@ export DOCKER_VERSION ?= latest export BUILD_DATE := $(shell date +%Y-%m-%d) export BUILD_VERSION := $(shell date +%y%m) export BUILD_TYPE ?= stable -export TOMCAT_VERSION ?= 9.0.38 -export JOLOKIA_VERSION ?= 1.6.2 -export HAWTIO_VERSION ?= 2.10.2 +export TOMCAT_VERSION ?= 9.0.56 +export JOLOKIA_VERSION ?= 1.7.1 +export HAWTIO_VERSION ?= 2.14.1 .PHONY: build shell run exec start stop clean compose-file diff --git a/hooks/stop b/hooks/stop index 9706d23..94466bc 100755 --- a/hooks/stop +++ b/hooks/stop @@ -1,7 +1,5 @@ #!/bin/bash -set -x - # Custom build for Docker Hub # see: https://medium.com/microscaling-systems/labelling-automated-builds-on-docker-hub-f3d073fb8e1