From d32c22904783ed03e7888e0c7f103a852117ad3a Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 09:34:47 +1100 Subject: [PATCH 01/12] Issue #113 Fix #113 by creating multistage builds that first download keys. Also took opportunity to reorder Dockerfiles to reduce complexity and size. Signed-off-by: Greg Wilkins --- 9.2-jre8/Dockerfile | 63 +++++++++++++++++++------------------------- 9.3-jre8/Dockerfile | 63 +++++++++++++++++++------------------------- 9.4-jre11/Dockerfile | 61 +++++++++++++++++++++--------------------- 9.4-jre8/Dockerfile | 62 +++++++++++++++++++++---------------------- 4 files changed, 114 insertions(+), 135 deletions(-) diff --git a/9.2-jre8/Dockerfile b/9.2-jre8/Dockerfile index c9620d5..4230fe9 100644 --- a/9.2-jre8/Dockerfile +++ b/9.2-jre8/Dockerfile @@ -1,15 +1,4 @@ -FROM openjdk:8-jre - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r jetty && useradd -r -g jetty jetty - -ENV JETTY_HOME /usr/local/jetty -ENV PATH $JETTY_HOME/bin:$PATH -RUN mkdir -p "$JETTY_HOME" -WORKDIR $JETTY_HOME - -ENV JETTY_VERSION 9.2.28.v20190418 -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz +FROM openjdk:8-jre AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -31,36 +20,38 @@ ENV JETTY_GPG_KEYS \ 5C9579B3DB2E506429319AAEF33B071B29559E1E RUN set -xe \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && export GNUPGHOME="$(mktemp -d)" \ + && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr demo-base javadoc \ - && rm jetty.tar.gz* \ - && rm -rf /tmp/hsperfdata_root - -ENV JETTY_BASE /var/lib/jetty -RUN mkdir -p "$JETTY_BASE" -WORKDIR $JETTY_BASE + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Get the list of modules in the default start.ini and build new base with those modules -RUN modules="$(grep -- ^--module= "$JETTY_HOME/start.ini" | cut -d= -f2 | paste -d, -s)" \ - && set -xe \ - && java -jar "$JETTY_HOME/start.jar" --add-to-startd="$modules" \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root +# Start a new image and import keys +FROM openjdk:8-jre +COPY --from=keys /jetty-keys/ /jetty-keys/ +ENV JETTY_VERSION 9.2.28.v20190418 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz + RUN set -xe \ - && mkdir -p "$TMPDIR" \ - && chown -R jetty:jetty "$TMPDIR" + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr demo-base javadoc jetty.tar.gz* \ + && cd $JETTY_BASE \ + && modules="$(grep -- ^--module= "$JETTY_HOME/start.ini" | cut -d= -f2 | paste -d, -s)" \ + && java -jar "$JETTY_HOME/start.jar" --add-to-startd="$modules" \ + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root /jetty-keys +WORKDIR $JETTY_BASE COPY docker-entrypoint.sh generate-jetty-start.sh / USER jetty diff --git a/9.3-jre8/Dockerfile b/9.3-jre8/Dockerfile index 5160b66..dd28ecc 100644 --- a/9.3-jre8/Dockerfile +++ b/9.3-jre8/Dockerfile @@ -1,15 +1,4 @@ -FROM openjdk:8-jre - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r jetty && useradd -r -g jetty jetty - -ENV JETTY_HOME /usr/local/jetty -ENV PATH $JETTY_HOME/bin:$PATH -RUN mkdir -p "$JETTY_HOME" -WORKDIR $JETTY_HOME - -ENV JETTY_VERSION 9.3.27.v20190418 -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz +FROM openjdk:8-jre AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -31,36 +20,38 @@ ENV JETTY_GPG_KEYS \ 5C9579B3DB2E506429319AAEF33B071B29559E1E RUN set -xe \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && export GNUPGHOME="$(mktemp -d)" \ + && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr demo-base javadoc \ - && rm jetty.tar.gz* \ - && rm -rf /tmp/hsperfdata_root - -ENV JETTY_BASE /var/lib/jetty -RUN mkdir -p "$JETTY_BASE" -WORKDIR $JETTY_BASE + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Get the list of modules in the default start.ini and build new base with those modules -RUN modules="$(grep -- ^--module= "$JETTY_HOME/start.ini" | cut -d= -f2 | paste -d, -s)" \ - && set -xe \ - && java -jar "$JETTY_HOME/start.jar" --add-to-startd="$modules" \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root +# Start a new image and import keys +FROM openjdk:8-jre +COPY --from=keys /jetty-keys/ /jetty-keys/ +ENV JETTY_VERSION 9.3.27.v20190418 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz + RUN set -xe \ - && mkdir -p "$TMPDIR" \ - && chown -R jetty:jetty "$TMPDIR" + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr demo-base javadoc jetty.tar.gz* \ + && cd $JETTY_BASE \ + && modules="$(grep -- ^--module= "$JETTY_HOME/start.ini" | cut -d= -f2 | paste -d, -s)" \ + && java -jar "$JETTY_HOME/start.jar" --add-to-startd="$modules" \ + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root /jetty-keys +WORKDIR $JETTY_BASE COPY docker-entrypoint.sh generate-jetty-start.sh / USER jetty diff --git a/9.4-jre11/Dockerfile b/9.4-jre11/Dockerfile index 45a59a3..63eb742 100644 --- a/9.4-jre11/Dockerfile +++ b/9.4-jre11/Dockerfile @@ -1,15 +1,4 @@ -FROM openjdk:11-jre - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r jetty && useradd -r -g jetty jetty - -ENV JETTY_HOME /usr/local/jetty -ENV PATH $JETTY_HOME/bin:$PATH -RUN mkdir -p "$JETTY_HOME" -WORKDIR $JETTY_HOME - -ENV JETTY_VERSION 9.4.23.v20191118 -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz +FROM openjdk:11-jre AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -31,35 +20,45 @@ ENV JETTY_GPG_KEYS \ 5C9579B3DB2E506429319AAEF33B071B29559E1E RUN set -xe \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && export GNUPGHOME="$(mktemp -d)" \ + && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && rm -rf "$GNUPGHOME" \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm jetty.tar.gz* \ - && rm -rf /tmp/hsperfdata_root + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done + +# Start a new image and import keys +FROM openjdk:11-jre +COPY --from=keys /jetty-keys/ /jetty-keys/ +ENV JETTY_VERSION 9.4.23.v20191118 +ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty -RUN mkdir -p "$JETTY_BASE" -WORKDIR $JETTY_BASE +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr demo-base javadoc jetty.tar.gz* \ + && cd $JETTY_BASE \ && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root - -ENV TMPDIR /tmp/jetty -RUN set -xe \ - && mkdir -p "$TMPDIR" \ - && chown -R jetty:jetty "$TMPDIR" + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root /jetty-keys +WORKDIR $JETTY_BASE COPY docker-entrypoint.sh generate-jetty-start.sh / USER jetty EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] + +RUN set -xe \ + && chown -R jetty:jetty "$JETTY_BASE" \ + && rm -rf /tmp/hsperfdata_root + diff --git a/9.4-jre8/Dockerfile b/9.4-jre8/Dockerfile index 3fab3ca..987c466 100644 --- a/9.4-jre8/Dockerfile +++ b/9.4-jre8/Dockerfile @@ -1,15 +1,4 @@ -FROM openjdk:8-jre - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r jetty && useradd -r -g jetty jetty - -ENV JETTY_HOME /usr/local/jetty -ENV PATH $JETTY_HOME/bin:$PATH -RUN mkdir -p "$JETTY_HOME" -WORKDIR $JETTY_HOME - -ENV JETTY_VERSION 9.4.23.v20191118 -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz +FROM openjdk:8-jre AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -31,36 +20,45 @@ ENV JETTY_GPG_KEYS \ 5C9579B3DB2E506429319AAEF33B071B29559E1E RUN set -xe \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && export GNUPGHOME="$(mktemp -d)" \ + && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm jetty.tar.gz* \ - && rm -rf /tmp/hsperfdata_root + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done + +# Start a new image and import keys +FROM openjdk:8-jre +COPY --from=keys /jetty-keys/ /jetty-keys/ +ENV JETTY_VERSION 9.4.23.v20191118 +ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty -RUN mkdir -p "$JETTY_BASE" -WORKDIR $JETTY_BASE +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr demo-base javadoc jetty.tar.gz* \ + && cd $JETTY_BASE \ && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root - -ENV TMPDIR /tmp/jetty -RUN set -xe \ - && mkdir -p "$TMPDIR" \ - && chown -R jetty:jetty "$TMPDIR" + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root /jetty-keys +WORKDIR $JETTY_BASE COPY docker-entrypoint.sh generate-jetty-start.sh / USER jetty EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] + +RUN set -xe \ + && chown -R jetty:jetty "$JETTY_BASE" \ + && rm -rf /tmp/hsperfdata_root + From 072958dad7ad63e02811364a9a695a06e38475ec Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 09:46:35 +1100 Subject: [PATCH 02/12] remove alpine reference Signed-off-by: Greg Wilkins --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f4fb093..4398eca 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSIONS = $(foreach df,$(wildcard */alpine/Dockerfile */Dockerfile),$(df:%/Dockerfile=%)) +VERSIONS = $(foreach df,$(wildcard */Dockerfile),$(df:%/Dockerfile=%)) all: build From 1aa7db4080fb75feae63e7792a92284c483ea136 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 10:29:20 +1100 Subject: [PATCH 03/12] Issue #113 and #103 Cleaned up jetty-home usage Tested the approach for slim JDKs by adding another multi stage to do the validation, since gpg is not available in slim builds Signed-off-by: Greg Wilkins --- 9.2-jre8/Dockerfile | 2 +- 9.3-jre8/Dockerfile | 2 +- 9.4-jdk13-slim/Dockerfile | 73 ++++++++++++++++ 9.4-jdk13-slim/arches | 1 + 9.4-jdk13-slim/docker-entrypoint.sh | 113 +++++++++++++++++++++++++ 9.4-jdk13-slim/generate-jetty-start.sh | 7 ++ 9.4-jdk13/Dockerfile | 73 ++++++++++++++++ 9.4-jdk13/arches | 1 + 9.4-jdk13/docker-entrypoint.sh | 113 +++++++++++++++++++++++++ 9.4-jdk13/generate-jetty-start.sh | 7 ++ 9.4-jre11/Dockerfile | 33 +++++--- 9.4-jre8/Dockerfile | 6 +- 12 files changed, 414 insertions(+), 17 deletions(-) create mode 100644 9.4-jdk13-slim/Dockerfile create mode 100644 9.4-jdk13-slim/arches create mode 100755 9.4-jdk13-slim/docker-entrypoint.sh create mode 100755 9.4-jdk13-slim/generate-jetty-start.sh create mode 100644 9.4-jdk13/Dockerfile create mode 100644 9.4-jdk13/arches create mode 100755 9.4-jdk13/docker-entrypoint.sh create mode 100755 9.4-jdk13/generate-jetty-start.sh diff --git a/9.2-jre8/Dockerfile b/9.2-jre8/Dockerfile index 4230fe9..021828c 100644 --- a/9.2-jre8/Dockerfile +++ b/9.2-jre8/Dockerfile @@ -26,7 +26,7 @@ RUN set -xe \ # Start a new image and import keys FROM openjdk:8-jre -COPY --from=keys /jetty-keys/ /jetty-keys/ +COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.2.28.v20190418 ENV JETTY_HOME /usr/local/jetty diff --git a/9.3-jre8/Dockerfile b/9.3-jre8/Dockerfile index dd28ecc..883522c 100644 --- a/9.3-jre8/Dockerfile +++ b/9.3-jre8/Dockerfile @@ -26,7 +26,7 @@ RUN set -xe \ # Start a new image and import keys FROM openjdk:8-jre -COPY --from=keys /jetty-keys/ /jetty-keys/ +COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.3.27.v20190418 ENV JETTY_HOME /usr/local/jetty diff --git a/9.4-jdk13-slim/Dockerfile b/9.4-jdk13-slim/Dockerfile new file mode 100644 index 0000000..da085fd --- /dev/null +++ b/9.4-jdk13-slim/Dockerfile @@ -0,0 +1,73 @@ +FROM openjdk:13 AS Keys + +# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) +ENV JETTY_GPG_KEYS \ + # Jan Bartel + AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ + # Jesse McConnell + 2A684B57436A81FA8706B53C61C3351A438A3B7D \ + # Joakim Erdfelt + 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ + # Joakim Erdfelt + B59B67FD7904984367F931800818D9D68FB67BAC \ + # Joakim Erdfelt + BFBB21C246D7776836287A48A04E0C74ABB35FEA \ + # Simone Bordet + 8B096546B1A8F02656B15D3B1677D141BCF3584D \ + # Greg Wilkins + FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ + # Greg Wilkins + 5C9579B3DB2E506429319AAEF33B071B29559E1E + +RUN set -xe \ + && mkdir /jetty-keys \ + && for key in $JETTY_GPG_KEYS; do \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done + +# Start a new image to import jetty and validate keys +FROM openjdk:13 AS Jetty +COPY --from=Keys /jetty-keys/ /jetty-keys/ + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz + +RUN set -xe \ + && mkdir -p "$JETTY_HOME" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr jetty.tar.gz* + +# Start a new slim image and import jetty +FROM openjdk:13-slim +COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ + +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH + +RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root + +WORKDIR $JETTY_BASE +COPY docker-entrypoint.sh generate-jetty-start.sh / + +USER jetty +EXPOSE 8080 +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["java","-jar","/usr/local/jetty/start.jar"] + +RUN set -xe \ + && chown -R jetty:jetty "$JETTY_BASE" \ + && rm -rf /tmp/hsperfdata_root + diff --git a/9.4-jdk13-slim/arches b/9.4-jdk13-slim/arches new file mode 100644 index 0000000..e7b206a --- /dev/null +++ b/9.4-jdk13-slim/arches @@ -0,0 +1 @@ +amd64, arm64v8 diff --git a/9.4-jdk13-slim/docker-entrypoint.sh b/9.4-jdk13-slim/docker-entrypoint.sh new file mode 100755 index 0000000..41ccbe4 --- /dev/null +++ b/9.4-jdk13-slim/docker-entrypoint.sh @@ -0,0 +1,113 @@ +#!/bin/sh + +set -e + +if [ "$1" = jetty.sh ]; then + if ! command -v bash >/dev/null 2>&1 ; then + cat >&2 <<- 'EOWARN' + ******************************************************************** + ERROR: bash not found. Use of jetty.sh requires bash. + ******************************************************************** + EOWARN + exit 1 + fi + cat >&2 <<- 'EOWARN' + ******************************************************************** + WARNING: Use of jetty.sh from this image is deprecated and may + be removed at some point in the future. + + See the documentation for guidance on extending this image: + https://github.com/docker-library/docs/tree/master/jetty + ******************************************************************** + EOWARN +fi + +if ! command -v -- "$1" >/dev/null 2>&1 ; then + set -- java -jar "$JETTY_HOME/start.jar" "$@" +fi + +: ${TMPDIR:=/tmp/jetty} +[ -d "$TMPDIR" ] || mkdir -p $TMPDIR 2>/dev/null + +: ${JETTY_START:=$JETTY_BASE/jetty.start} + +case "$JAVA_OPTIONS" in + *-Djava.io.tmpdir=*) ;; + *) JAVA_OPTIONS="-Djava.io.tmpdir=$TMPDIR $JAVA_OPTIONS" ;; +esac + +if expr "$*" : 'java .*/start\.jar.*$' >/dev/null ; then + # this is a command to run jetty + + # check if it is a terminating command + for A in "$@" ; do + case $A in + --add-to-start* |\ + --create-files |\ + --create-startd |\ + --download |\ + --dry-run |\ + --exec-print |\ + --help |\ + --info |\ + --list-all-modules |\ + --list-classpath |\ + --list-config |\ + --list-modules* |\ + --stop |\ + --update-ini |\ + --version |\ + -v )\ + # It is a terminating command, so exec directly + JAVA="$1" + shift + exec $JAVA $JAVA_OPTIONS "$@" + esac + done + + if [ $(whoami) != "jetty" ]; then + cat >&2 <<- EOWARN + ******************************************************************** + WARNING: User is $(whoami) + The user should be (re)set to 'jetty' in the Dockerfile + ******************************************************************** + EOWARN + fi + + if [ -f $JETTY_START ] ; then + if [ $JETTY_BASE/start.d -nt $JETTY_START ] ; then + cat >&2 <<- EOWARN + ******************************************************************** + WARNING: The $JETTY_BASE/start.d directory has been modified since + the $JETTY_START files was generated. Either delete + the $JETTY_START file or re-run + /generate-jetty.start.sh + from a Dockerfile + ******************************************************************** + EOWARN + fi + echo $(date +'%Y-%m-%d %H:%M:%S.000'):INFO:docker-entrypoint:jetty start from $JETTY_START + set -- $(cat $JETTY_START) + else + # Do a jetty dry run to set the final command + JAVA="$1" + shift + $JAVA $JAVA_OPTIONS "$@" --dry-run > $JETTY_START + if [ $(egrep -v '\\$' $JETTY_START | wc -l ) -gt 1 ] ; then + # command was more than a dry-run + cat $JETTY_START \ + | awk '/\\$/ { printf "%s", substr($0, 1, length($0)-1); next } 1' \ + | egrep -v '[^ ]*java .* org\.eclipse\.jetty\.xml\.XmlConfiguration ' + exit + fi + set -- $(sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' $JETTY_START) + fi +fi + +if [ "${1##*/}" = java -a -n "$JAVA_OPTIONS" ] ; then + JAVA="$1" + shift + set -- "$JAVA" $JAVA_OPTIONS "$@" +fi + +exec "$@" diff --git a/9.4-jdk13-slim/generate-jetty-start.sh b/9.4-jdk13-slim/generate-jetty-start.sh new file mode 100755 index 0000000..5895278 --- /dev/null +++ b/9.4-jdk13-slim/generate-jetty-start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -z "$JETTY_START" ] ; then + JETTY_START=$JETTY_BASE/jetty.start +fi +rm -f $JETTY_START +/docker-entrypoint.sh --dry-run | sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' > $JETTY_START diff --git a/9.4-jdk13/Dockerfile b/9.4-jdk13/Dockerfile new file mode 100644 index 0000000..02df79d --- /dev/null +++ b/9.4-jdk13/Dockerfile @@ -0,0 +1,73 @@ +FROM openjdk:13 AS Keys + +# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) +ENV JETTY_GPG_KEYS \ + # Jan Bartel + AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ + # Jesse McConnell + 2A684B57436A81FA8706B53C61C3351A438A3B7D \ + # Joakim Erdfelt + 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ + # Joakim Erdfelt + B59B67FD7904984367F931800818D9D68FB67BAC \ + # Joakim Erdfelt + BFBB21C246D7776836287A48A04E0C74ABB35FEA \ + # Simone Bordet + 8B096546B1A8F02656B15D3B1677D141BCF3584D \ + # Greg Wilkins + FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ + # Greg Wilkins + 5C9579B3DB2E506429319AAEF33B071B29559E1E + +RUN set -xe \ + && mkdir /jetty-keys \ + && for key in $JETTY_GPG_KEYS; do \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done + +# Start a new image to import jetty and validate keys +FROM openjdk:13 AS Jetty +COPY --from=Keys /jetty-keys/ /jetty-keys/ + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz + +RUN set -xe \ + && mkdir -p "$JETTY_HOME" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr jetty.tar.gz* + +# Start a new image and import jetty +FROM openjdk:13 +COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ + +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH + +RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root + +WORKDIR $JETTY_BASE +COPY docker-entrypoint.sh generate-jetty-start.sh / + +USER jetty +EXPOSE 8080 +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["java","-jar","/usr/local/jetty/start.jar"] + +RUN set -xe \ + && chown -R jetty:jetty "$JETTY_BASE" \ + && rm -rf /tmp/hsperfdata_root + diff --git a/9.4-jdk13/arches b/9.4-jdk13/arches new file mode 100644 index 0000000..e7b206a --- /dev/null +++ b/9.4-jdk13/arches @@ -0,0 +1 @@ +amd64, arm64v8 diff --git a/9.4-jdk13/docker-entrypoint.sh b/9.4-jdk13/docker-entrypoint.sh new file mode 100755 index 0000000..41ccbe4 --- /dev/null +++ b/9.4-jdk13/docker-entrypoint.sh @@ -0,0 +1,113 @@ +#!/bin/sh + +set -e + +if [ "$1" = jetty.sh ]; then + if ! command -v bash >/dev/null 2>&1 ; then + cat >&2 <<- 'EOWARN' + ******************************************************************** + ERROR: bash not found. Use of jetty.sh requires bash. + ******************************************************************** + EOWARN + exit 1 + fi + cat >&2 <<- 'EOWARN' + ******************************************************************** + WARNING: Use of jetty.sh from this image is deprecated and may + be removed at some point in the future. + + See the documentation for guidance on extending this image: + https://github.com/docker-library/docs/tree/master/jetty + ******************************************************************** + EOWARN +fi + +if ! command -v -- "$1" >/dev/null 2>&1 ; then + set -- java -jar "$JETTY_HOME/start.jar" "$@" +fi + +: ${TMPDIR:=/tmp/jetty} +[ -d "$TMPDIR" ] || mkdir -p $TMPDIR 2>/dev/null + +: ${JETTY_START:=$JETTY_BASE/jetty.start} + +case "$JAVA_OPTIONS" in + *-Djava.io.tmpdir=*) ;; + *) JAVA_OPTIONS="-Djava.io.tmpdir=$TMPDIR $JAVA_OPTIONS" ;; +esac + +if expr "$*" : 'java .*/start\.jar.*$' >/dev/null ; then + # this is a command to run jetty + + # check if it is a terminating command + for A in "$@" ; do + case $A in + --add-to-start* |\ + --create-files |\ + --create-startd |\ + --download |\ + --dry-run |\ + --exec-print |\ + --help |\ + --info |\ + --list-all-modules |\ + --list-classpath |\ + --list-config |\ + --list-modules* |\ + --stop |\ + --update-ini |\ + --version |\ + -v )\ + # It is a terminating command, so exec directly + JAVA="$1" + shift + exec $JAVA $JAVA_OPTIONS "$@" + esac + done + + if [ $(whoami) != "jetty" ]; then + cat >&2 <<- EOWARN + ******************************************************************** + WARNING: User is $(whoami) + The user should be (re)set to 'jetty' in the Dockerfile + ******************************************************************** + EOWARN + fi + + if [ -f $JETTY_START ] ; then + if [ $JETTY_BASE/start.d -nt $JETTY_START ] ; then + cat >&2 <<- EOWARN + ******************************************************************** + WARNING: The $JETTY_BASE/start.d directory has been modified since + the $JETTY_START files was generated. Either delete + the $JETTY_START file or re-run + /generate-jetty.start.sh + from a Dockerfile + ******************************************************************** + EOWARN + fi + echo $(date +'%Y-%m-%d %H:%M:%S.000'):INFO:docker-entrypoint:jetty start from $JETTY_START + set -- $(cat $JETTY_START) + else + # Do a jetty dry run to set the final command + JAVA="$1" + shift + $JAVA $JAVA_OPTIONS "$@" --dry-run > $JETTY_START + if [ $(egrep -v '\\$' $JETTY_START | wc -l ) -gt 1 ] ; then + # command was more than a dry-run + cat $JETTY_START \ + | awk '/\\$/ { printf "%s", substr($0, 1, length($0)-1); next } 1' \ + | egrep -v '[^ ]*java .* org\.eclipse\.jetty\.xml\.XmlConfiguration ' + exit + fi + set -- $(sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' $JETTY_START) + fi +fi + +if [ "${1##*/}" = java -a -n "$JAVA_OPTIONS" ] ; then + JAVA="$1" + shift + set -- "$JAVA" $JAVA_OPTIONS "$@" +fi + +exec "$@" diff --git a/9.4-jdk13/generate-jetty-start.sh b/9.4-jdk13/generate-jetty-start.sh new file mode 100755 index 0000000..5895278 --- /dev/null +++ b/9.4-jdk13/generate-jetty-start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -z "$JETTY_START" ] ; then + JETTY_START=$JETTY_BASE/jetty.start +fi +rm -f $JETTY_START +/docker-entrypoint.sh --dry-run | sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' > $JETTY_START diff --git a/9.4-jre11/Dockerfile b/9.4-jre11/Dockerfile index 51a5949..f77c3cc 100644 --- a/9.4-jre11/Dockerfile +++ b/9.4-jre11/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:11-jre AS Keys +FROM openjdk:13 AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -24,31 +24,40 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image and import keys -FROM openjdk:11-jre -COPY --from=keys /jetty-keys/ /jetty-keys/ +# Start a new image to import jetty and validate keys +FROM openjdk:13 AS Jetty +COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz RUN set -xe \ - && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr demo-base javadoc jetty.tar.gz* \ + && rm -fr jetty.tar.gz* + +# Start a new image and import jetty +FROM openjdk:11-jre +COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ + +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH + +RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_BASE" "$TMPDIR" \ && cd $JETTY_BASE \ && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ - && rm -rf /tmp/hsperfdata_root /jetty-keys + && rm -rf /tmp/hsperfdata_root WORKDIR $JETTY_BASE COPY docker-entrypoint.sh generate-jetty-start.sh / diff --git a/9.4-jre8/Dockerfile b/9.4-jre8/Dockerfile index 4bd0d44..a835aa1 100644 --- a/9.4-jre8/Dockerfile +++ b/9.4-jre8/Dockerfile @@ -26,14 +26,14 @@ RUN set -xe \ # Start a new image and import keys FROM openjdk:8-jre -COPY --from=keys /jetty-keys/ /jetty-keys/ +COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/$JETTY_VERSION/jetty-distribution-$JETTY_VERSION.tar.gz +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz RUN set -xe \ && groupadd -r jetty && useradd -r -g jetty jetty \ @@ -44,7 +44,7 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr demo-base javadoc jetty.tar.gz* \ + && rm -fr jetty.tar.gz* \ && cd $JETTY_BASE \ && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ From 69d49f2f458a4a08b37d0a44fa437d4ad137f44b Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 10:49:51 +1100 Subject: [PATCH 04/12] added jre11-slim Signed-off-by: Greg Wilkins --- 9.4-jre8/Dockerfile | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/9.4-jre8/Dockerfile b/9.4-jre8/Dockerfile index a835aa1..f23fa57 100644 --- a/9.4-jre8/Dockerfile +++ b/9.4-jre8/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jre AS Keys +FROM openjdk:13 AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -24,31 +24,40 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image and import keys -FROM openjdk:8-jre +# Start a new image to import jetty and validate keys +FROM openjdk:13 AS Jetty COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz RUN set -xe \ - && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* \ + && rm -fr jetty.tar.gz* + +# Start a new image and import jetty +FROM openjdk:8-jre +COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ + +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH + +RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_BASE" "$TMPDIR" \ && cd $JETTY_BASE \ && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ - && rm -rf /tmp/hsperfdata_root /jetty-keys + && rm -rf /tmp/hsperfdata_root WORKDIR $JETTY_BASE COPY docker-entrypoint.sh generate-jetty-start.sh / @@ -61,4 +70,3 @@ CMD ["java","-jar","/usr/local/jetty/start.jar"] RUN set -xe \ && chown -R jetty:jetty "$JETTY_BASE" \ && rm -rf /tmp/hsperfdata_root - From 5d94d03157e469bc0364f5b043bb3beb0a54e73e Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 17:23:35 +1100 Subject: [PATCH 05/12] added jre11-slim Signed-off-by: Greg Wilkins --- 9.4-jre11-slim/Dockerfile | 73 ++++++++++++++++ 9.4-jre11-slim/arches | 1 + 9.4-jre11-slim/docker-entrypoint.sh | 113 +++++++++++++++++++++++++ 9.4-jre11-slim/generate-jetty-start.sh | 7 ++ update.sh | 19 ++--- 5 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 9.4-jre11-slim/Dockerfile create mode 100644 9.4-jre11-slim/arches create mode 100755 9.4-jre11-slim/docker-entrypoint.sh create mode 100755 9.4-jre11-slim/generate-jetty-start.sh diff --git a/9.4-jre11-slim/Dockerfile b/9.4-jre11-slim/Dockerfile new file mode 100644 index 0000000..8880aff --- /dev/null +++ b/9.4-jre11-slim/Dockerfile @@ -0,0 +1,73 @@ +FROM openjdk:13 AS Keys + +# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) +ENV JETTY_GPG_KEYS \ + # Jan Bartel + AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ + # Jesse McConnell + 2A684B57436A81FA8706B53C61C3351A438A3B7D \ + # Joakim Erdfelt + 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ + # Joakim Erdfelt + B59B67FD7904984367F931800818D9D68FB67BAC \ + # Joakim Erdfelt + BFBB21C246D7776836287A48A04E0C74ABB35FEA \ + # Simone Bordet + 8B096546B1A8F02656B15D3B1677D141BCF3584D \ + # Greg Wilkins + FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ + # Greg Wilkins + 5C9579B3DB2E506429319AAEF33B071B29559E1E + +RUN set -xe \ + && mkdir /jetty-keys \ + && for key in $JETTY_GPG_KEYS; do \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done + +# Start a new image to import jetty and validate keys +FROM openjdk:13 AS Jetty +COPY --from=Keys /jetty-keys/ /jetty-keys/ + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz + +RUN set -xe \ + && mkdir -p "$JETTY_HOME" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr jetty.tar.gz* + +# Start a new image and import jetty +FROM openjdk:11-jre-slim +COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ + +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH + +RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root + +WORKDIR $JETTY_BASE +COPY docker-entrypoint.sh generate-jetty-start.sh / + +USER jetty +EXPOSE 8080 +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["java","-jar","/usr/local/jetty/start.jar"] + +RUN set -xe \ + && chown -R jetty:jetty "$JETTY_BASE" \ + && rm -rf /tmp/hsperfdata_root + diff --git a/9.4-jre11-slim/arches b/9.4-jre11-slim/arches new file mode 100644 index 0000000..e7b206a --- /dev/null +++ b/9.4-jre11-slim/arches @@ -0,0 +1 @@ +amd64, arm64v8 diff --git a/9.4-jre11-slim/docker-entrypoint.sh b/9.4-jre11-slim/docker-entrypoint.sh new file mode 100755 index 0000000..41ccbe4 --- /dev/null +++ b/9.4-jre11-slim/docker-entrypoint.sh @@ -0,0 +1,113 @@ +#!/bin/sh + +set -e + +if [ "$1" = jetty.sh ]; then + if ! command -v bash >/dev/null 2>&1 ; then + cat >&2 <<- 'EOWARN' + ******************************************************************** + ERROR: bash not found. Use of jetty.sh requires bash. + ******************************************************************** + EOWARN + exit 1 + fi + cat >&2 <<- 'EOWARN' + ******************************************************************** + WARNING: Use of jetty.sh from this image is deprecated and may + be removed at some point in the future. + + See the documentation for guidance on extending this image: + https://github.com/docker-library/docs/tree/master/jetty + ******************************************************************** + EOWARN +fi + +if ! command -v -- "$1" >/dev/null 2>&1 ; then + set -- java -jar "$JETTY_HOME/start.jar" "$@" +fi + +: ${TMPDIR:=/tmp/jetty} +[ -d "$TMPDIR" ] || mkdir -p $TMPDIR 2>/dev/null + +: ${JETTY_START:=$JETTY_BASE/jetty.start} + +case "$JAVA_OPTIONS" in + *-Djava.io.tmpdir=*) ;; + *) JAVA_OPTIONS="-Djava.io.tmpdir=$TMPDIR $JAVA_OPTIONS" ;; +esac + +if expr "$*" : 'java .*/start\.jar.*$' >/dev/null ; then + # this is a command to run jetty + + # check if it is a terminating command + for A in "$@" ; do + case $A in + --add-to-start* |\ + --create-files |\ + --create-startd |\ + --download |\ + --dry-run |\ + --exec-print |\ + --help |\ + --info |\ + --list-all-modules |\ + --list-classpath |\ + --list-config |\ + --list-modules* |\ + --stop |\ + --update-ini |\ + --version |\ + -v )\ + # It is a terminating command, so exec directly + JAVA="$1" + shift + exec $JAVA $JAVA_OPTIONS "$@" + esac + done + + if [ $(whoami) != "jetty" ]; then + cat >&2 <<- EOWARN + ******************************************************************** + WARNING: User is $(whoami) + The user should be (re)set to 'jetty' in the Dockerfile + ******************************************************************** + EOWARN + fi + + if [ -f $JETTY_START ] ; then + if [ $JETTY_BASE/start.d -nt $JETTY_START ] ; then + cat >&2 <<- EOWARN + ******************************************************************** + WARNING: The $JETTY_BASE/start.d directory has been modified since + the $JETTY_START files was generated. Either delete + the $JETTY_START file or re-run + /generate-jetty.start.sh + from a Dockerfile + ******************************************************************** + EOWARN + fi + echo $(date +'%Y-%m-%d %H:%M:%S.000'):INFO:docker-entrypoint:jetty start from $JETTY_START + set -- $(cat $JETTY_START) + else + # Do a jetty dry run to set the final command + JAVA="$1" + shift + $JAVA $JAVA_OPTIONS "$@" --dry-run > $JETTY_START + if [ $(egrep -v '\\$' $JETTY_START | wc -l ) -gt 1 ] ; then + # command was more than a dry-run + cat $JETTY_START \ + | awk '/\\$/ { printf "%s", substr($0, 1, length($0)-1); next } 1' \ + | egrep -v '[^ ]*java .* org\.eclipse\.jetty\.xml\.XmlConfiguration ' + exit + fi + set -- $(sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' $JETTY_START) + fi +fi + +if [ "${1##*/}" = java -a -n "$JAVA_OPTIONS" ] ; then + JAVA="$1" + shift + set -- "$JAVA" $JAVA_OPTIONS "$@" +fi + +exec "$@" diff --git a/9.4-jre11-slim/generate-jetty-start.sh b/9.4-jre11-slim/generate-jetty-start.sh new file mode 100755 index 0000000..5895278 --- /dev/null +++ b/9.4-jre11-slim/generate-jetty-start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -z "$JETTY_START" ] ; then + JETTY_START=$JETTY_BASE/jetty.start +fi +rm -f $JETTY_START +/docker-entrypoint.sh --dry-run | sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' > $JETTY_START diff --git a/update.sh b/update.sh index 33f9c52..d97c343 100755 --- a/update.sh +++ b/update.sh @@ -54,15 +54,12 @@ for path in "${paths[@]}"; do exit 1 fi - for variant in alpine ''; do - [ -d "$path/$variant" ] || continue - ( - set -x - cp docker-entrypoint.sh generate-jetty-start.sh "$path/$variant" - sed -ri ' - s/^(FROM) .*/\1 '"$baseImage${variant:+-$variant}"'/; - s/^(ENV JETTY_VERSION) .*/\1 '"$fullVersion"'/; - ' "$path/$variant/Dockerfile" - ) - done + if [ -d "$path" ]; then + set -x + cp docker-entrypoint.sh generate-jetty-start.sh "$path" + sed -ri ' + s/^(FROM) .*/\1 '"$baseImage"'/; + s/^(ENV JETTY_VERSION) .*/\1 '"$fullVersion"'/; + ' "$path/Dockerfile" + fi done From 4c04e095758fa83814cc2aabaff985cc258f61de Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 17:36:21 +1100 Subject: [PATCH 06/12] removed variants from update script Also ran update of 9.2 and 9.3 Signed-off-by: Greg Wilkins --- 9.2-jre8/Dockerfile | 2 +- 9.3-jre8/Dockerfile | 2 +- update.sh | 13 +------------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/9.2-jre8/Dockerfile b/9.2-jre8/Dockerfile index 021828c..0a28aac 100644 --- a/9.2-jre8/Dockerfile +++ b/9.2-jre8/Dockerfile @@ -28,7 +28,7 @@ RUN set -xe \ FROM openjdk:8-jre COPY --from=Keys /jetty-keys/ /jetty-keys/ -ENV JETTY_VERSION 9.2.28.v20190418 +ENV JETTY_VERSION 9.2.29.v20191105 ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty diff --git a/9.3-jre8/Dockerfile b/9.3-jre8/Dockerfile index 883522c..54d4763 100644 --- a/9.3-jre8/Dockerfile +++ b/9.3-jre8/Dockerfile @@ -28,7 +28,7 @@ RUN set -xe \ FROM openjdk:8-jre COPY --from=Keys /jetty-keys/ /jetty-keys/ -ENV JETTY_VERSION 9.3.27.v20190418 +ENV JETTY_VERSION 9.3.28.v20191105 ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty diff --git a/update.sh b/update.sh index d97c343..9282e45 100755 --- a/update.sh +++ b/update.sh @@ -18,13 +18,6 @@ for path in "${paths[@]}"; do version="${path%%-*}" # "9.2" suffix="${path#*-}" # "jre7" - baseImage='openjdk' - case "$suffix" in - jre*|jdk*) - baseImage+=":${suffix:3}-${suffix:0:3}" # ":7-jre" - ;; - esac - milestones=() releaseCandidates=() fullReleases=() @@ -55,11 +48,7 @@ for path in "${paths[@]}"; do fi if [ -d "$path" ]; then - set -x cp docker-entrypoint.sh generate-jetty-start.sh "$path" - sed -ri ' - s/^(FROM) .*/\1 '"$baseImage"'/; - s/^(ENV JETTY_VERSION) .*/\1 '"$fullVersion"'/; - ' "$path/Dockerfile" + sed -ri 's/^(ENV JETTY_VERSION) .*/\1 '"$fullVersion"'/; ' "$path/Dockerfile" fi done From 4d81b7afeec2fdc13acc82708dadea9ff4757e69 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 17:46:11 +1100 Subject: [PATCH 07/12] removed variants from generate-stackbrew-library Signed-off-by: Greg Wilkins --- generate-stackbrew-library.sh | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 038c13a..b697e9b 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -4,10 +4,9 @@ shopt -s globstar declare -A aliases aliases=( - [9.2-jre7]='jre7' - [9.4-jre8]='latest jre8' + [9.4-jdk13]='latest jdk13' ) -defaultJdk="jre8" +defaultJdk="jdk13" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" @@ -41,14 +40,6 @@ for path in "${paths[@]}"; do commit="$(git log -1 --format='format:%H' -- "$directory")" version="$(grep -m1 'ENV JETTY_VERSION ' "$directory/Dockerfile" | cut -d' ' -f3)" - # Determine if this is a variant image - if [[ "$path" = */* ]]; then - variant=${path#*/} # "alpine" - path=${path%/*} - else - variant='' - fi - # Determine the JDK jdk=${path#*-} # "jre7" @@ -67,28 +58,23 @@ for path in "${paths[@]}"; do fi # Output ${versionAliases[@]} without JDK - # e.g. 9.2.10, 9.2, 9, 9.3-alpine + # e.g. 9.2.10, 9.2, 9 if [ "$jdk" = "$defaultJdk" ]; then for va in "${versionAliases[@]}"; do - addTag "$va${variant:+-$variant}" + addTag "$va" done fi # Output ${versionAliases[@]} with JDK suffixes - # e.g. 9.2.10-jre7, 9.2-jre7, 9-jre7, 9-jre8-alpine + # e.g. 9.2.10-jre7, 9.2-jre7, 9-jre7, 9-jre11-slim for va in "${versionAliases[@]}"; do - addTag "$va-$jdk${variant:+-$variant}" + addTag "$va-$jdk" done # Output custom aliases - # e.g. latest, jre7, jre8, alpine + # e.g. latest, jre7, jre8 if [ ${#aliases[$path]} -gt 0 ]; then for va in ${aliases[$path]}; do - if [ ! -z "$variant" -a "$va" = 'latest' ]; then - va="$variant" - else - va="$va${variant:+-$variant}" - fi addTag "$va" done fi From 26e7bf24f05aa471fc7244b5415a62b7618144c9 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 25 Nov 2019 18:33:32 +1100 Subject: [PATCH 08/12] Added a template Dockerfile for 9.4 images The update.sh script will copy the Dockerfile-9.4 template and modify it as needed. Signed-off-by: Greg Wilkins --- 9.4-jdk13-slim/Dockerfile | 10 +++--- 9.4-jdk13/Dockerfile | 8 ++--- 9.4-jre11-slim/Dockerfile | 6 ++-- 9.4-jre11/Dockerfile | 6 ++-- 9.4-jre8/Dockerfile | 5 +-- Dockerfile-9.4 | 72 +++++++++++++++++++++++++++++++++++++++ update.sh | 13 +++++-- 7 files changed, 100 insertions(+), 20 deletions(-) create mode 100644 Dockerfile-9.4 diff --git a/9.4-jdk13-slim/Dockerfile b/9.4-jdk13-slim/Dockerfile index da085fd..f04ba78 100644 --- a/9.4-jdk13-slim/Dockerfile +++ b/9.4-jdk13-slim/Dockerfile @@ -1,4 +1,5 @@ -FROM openjdk:13 AS Keys +# DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh +FROM openjdk:13-jdk AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,7 +26,7 @@ RUN set -xe \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done # Start a new image to import jetty and validate keys -FROM openjdk:13 AS Jetty +FROM openjdk:13-jdk AS Jetty COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 @@ -42,8 +43,8 @@ RUN set -xe \ && sed -i '/jetty-logging/d' etc/jetty.conf \ && rm -fr jetty.tar.gz* -# Start a new slim image and import jetty -FROM openjdk:13-slim +# Start a new image and import jetty +FROM openjdk:13-jdk-slim COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty @@ -70,4 +71,3 @@ CMD ["java","-jar","/usr/local/jetty/start.jar"] RUN set -xe \ && chown -R jetty:jetty "$JETTY_BASE" \ && rm -rf /tmp/hsperfdata_root - diff --git a/9.4-jdk13/Dockerfile b/9.4-jdk13/Dockerfile index 02df79d..031300e 100644 --- a/9.4-jdk13/Dockerfile +++ b/9.4-jdk13/Dockerfile @@ -1,4 +1,5 @@ -FROM openjdk:13 AS Keys +# DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh +FROM openjdk:13-jdk AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,7 +26,7 @@ RUN set -xe \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done # Start a new image to import jetty and validate keys -FROM openjdk:13 AS Jetty +FROM openjdk:13-jdk AS Jetty COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 @@ -43,7 +44,7 @@ RUN set -xe \ && rm -fr jetty.tar.gz* # Start a new image and import jetty -FROM openjdk:13 +FROM openjdk:13-jdk COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty @@ -70,4 +71,3 @@ CMD ["java","-jar","/usr/local/jetty/start.jar"] RUN set -xe \ && chown -R jetty:jetty "$JETTY_BASE" \ && rm -rf /tmp/hsperfdata_root - diff --git a/9.4-jre11-slim/Dockerfile b/9.4-jre11-slim/Dockerfile index 8880aff..2cef2e5 100644 --- a/9.4-jre11-slim/Dockerfile +++ b/9.4-jre11-slim/Dockerfile @@ -1,4 +1,5 @@ -FROM openjdk:13 AS Keys +# DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh +FROM openjdk:13-jdk AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,7 +26,7 @@ RUN set -xe \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done # Start a new image to import jetty and validate keys -FROM openjdk:13 AS Jetty +FROM openjdk:13-jdk AS Jetty COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 @@ -70,4 +71,3 @@ CMD ["java","-jar","/usr/local/jetty/start.jar"] RUN set -xe \ && chown -R jetty:jetty "$JETTY_BASE" \ && rm -rf /tmp/hsperfdata_root - diff --git a/9.4-jre11/Dockerfile b/9.4-jre11/Dockerfile index f77c3cc..33248c1 100644 --- a/9.4-jre11/Dockerfile +++ b/9.4-jre11/Dockerfile @@ -1,4 +1,5 @@ -FROM openjdk:13 AS Keys +# DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh +FROM openjdk:13-jdk AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,7 +26,7 @@ RUN set -xe \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done # Start a new image to import jetty and validate keys -FROM openjdk:13 AS Jetty +FROM openjdk:13-jdk AS Jetty COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 @@ -70,4 +71,3 @@ CMD ["java","-jar","/usr/local/jetty/start.jar"] RUN set -xe \ && chown -R jetty:jetty "$JETTY_BASE" \ && rm -rf /tmp/hsperfdata_root - diff --git a/9.4-jre8/Dockerfile b/9.4-jre8/Dockerfile index f23fa57..3c457ee 100644 --- a/9.4-jre8/Dockerfile +++ b/9.4-jre8/Dockerfile @@ -1,4 +1,5 @@ -FROM openjdk:13 AS Keys +# DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh +FROM openjdk:13-jdk AS Keys # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,7 +26,7 @@ RUN set -xe \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done # Start a new image to import jetty and validate keys -FROM openjdk:13 AS Jetty +FROM openjdk:13-jdk AS Jetty COPY --from=Keys /jetty-keys/ /jetty-keys/ ENV JETTY_VERSION 9.4.24.v20191120 diff --git a/Dockerfile-9.4 b/Dockerfile-9.4 new file mode 100644 index 0000000..efc81d3 --- /dev/null +++ b/Dockerfile-9.4 @@ -0,0 +1,72 @@ +FROM openjdk:13-jdk AS Keys + +# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) +ENV JETTY_GPG_KEYS \ + # Jan Bartel + AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ + # Jesse McConnell + 2A684B57436A81FA8706B53C61C3351A438A3B7D \ + # Joakim Erdfelt + 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ + # Joakim Erdfelt + B59B67FD7904984367F931800818D9D68FB67BAC \ + # Joakim Erdfelt + BFBB21C246D7776836287A48A04E0C74ABB35FEA \ + # Simone Bordet + 8B096546B1A8F02656B15D3B1677D141BCF3584D \ + # Greg Wilkins + FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ + # Greg Wilkins + 5C9579B3DB2E506429319AAEF33B071B29559E1E + +RUN set -xe \ + && mkdir /jetty-keys \ + && for key in $JETTY_GPG_KEYS; do \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done + +# Start a new image to import jetty and validate keys +FROM openjdk:13-jdk AS Jetty +COPY --from=Keys /jetty-keys/ /jetty-keys/ + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz + +RUN set -xe \ + && mkdir -p "$JETTY_HOME" \ + && cd $JETTY_HOME \ + && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ + && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ + && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ + && tar -xvf jetty.tar.gz --strip-components=1 \ + && sed -i '/jetty-logging/d' etc/jetty.conf \ + && rm -fr jetty.tar.gz* + +# Start a new image and import jetty +FROM openjdk:LABEL +COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ + +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH + +RUN set -xe \ + && groupadd -r jetty && useradd -r -g jetty jetty \ + && mkdir -p "$JETTY_BASE" "$TMPDIR" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ + && rm -rf /tmp/hsperfdata_root + +WORKDIR $JETTY_BASE +COPY docker-entrypoint.sh generate-jetty-start.sh / + +USER jetty +EXPOSE 8080 +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["java","-jar","/usr/local/jetty/start.jar"] + +RUN set -xe \ + && chown -R jetty:jetty "$JETTY_BASE" \ + && rm -rf /tmp/hsperfdata_root diff --git a/update.sh b/update.sh index 9282e45..e482d66 100755 --- a/update.sh +++ b/update.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -ueo pipefail - cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" paths=( "$@" ) @@ -16,7 +14,11 @@ available=( $( curl -sSL "$MAVEN_METADATA_URL" | grep -Eo '<(version)>[^<]* for path in "${paths[@]}"; do version="${path%%-*}" # "9.2" - suffix="${path#*-}" # "jre7" + jvm="${path#*-}" # "jre11-slim" + disto=$(expr "$jvm" : '\(j..\)[0-9].*') # jre + variant=$(expr "$jvm" : '.*-\(.*\)') # slim + release=$(expr "$jvm" : 'j..\([0-9][0-9]*\).*') # 11 + label=${release}-${disto}${variant:+-$variant} # 11-jre-slim milestones=() releaseCandidates=() @@ -49,6 +51,11 @@ for path in "${paths[@]}"; do if [ -d "$path" ]; then cp docker-entrypoint.sh generate-jetty-start.sh "$path" + if [ "$version" == "9.4" ] ; then + echo '# DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh' > "$path"/Dockerfile + cat Dockerfile-9.4 >> "$path"/Dockerfile + sed -ri 's/^(FROM openjdk:)LABEL/\1'"$label"'/; ' "$path/Dockerfile" + fi sed -ri 's/^(ENV JETTY_VERSION) .*/\1 '"$fullVersion"'/; ' "$path/Dockerfile" fi done From e6cb7908c91ed60c73c0f90feb69c44dba457d3f Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 28 Nov 2019 07:47:57 +1100 Subject: [PATCH 09/12] use only a single stage Signed-off-by: Greg Wilkins --- 9.4-jdk13-slim/Dockerfile | 18 +++++++----------- 9.4-jdk13/Dockerfile | 18 +++++++----------- 9.4-jre11-slim/Dockerfile | 18 +++++++----------- 9.4-jre11/Dockerfile | 18 +++++++----------- 9.4-jre8/Dockerfile | 18 +++++++----------- Dockerfile-9.4 | 18 +++++++----------- 6 files changed, 42 insertions(+), 66 deletions(-) diff --git a/9.4-jdk13-slim/Dockerfile b/9.4-jdk13-slim/Dockerfile index f04ba78..7934057 100644 --- a/9.4-jdk13-slim/Dockerfile +++ b/9.4-jdk13-slim/Dockerfile @@ -1,5 +1,9 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Keys +FROM openjdk:13-jdk AS Jetty94 + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,14 +29,6 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image to import jetty and validate keys -FROM openjdk:13-jdk AS Jetty -COPY --from=Keys /jetty-keys/ /jetty-keys/ - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - RUN set -xe \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ @@ -43,9 +39,9 @@ RUN set -xe \ && sed -i '/jetty-logging/d' etc/jetty.conf \ && rm -fr jetty.tar.gz* -# Start a new image and import jetty +# Start a new image on the target and import jetty FROM openjdk:13-jdk-slim -COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ +COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty diff --git a/9.4-jdk13/Dockerfile b/9.4-jdk13/Dockerfile index 031300e..7662e0a 100644 --- a/9.4-jdk13/Dockerfile +++ b/9.4-jdk13/Dockerfile @@ -1,5 +1,9 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Keys +FROM openjdk:13-jdk AS Jetty94 + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,14 +29,6 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image to import jetty and validate keys -FROM openjdk:13-jdk AS Jetty -COPY --from=Keys /jetty-keys/ /jetty-keys/ - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - RUN set -xe \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ @@ -43,9 +39,9 @@ RUN set -xe \ && sed -i '/jetty-logging/d' etc/jetty.conf \ && rm -fr jetty.tar.gz* -# Start a new image and import jetty +# Start a new image on the target and import jetty FROM openjdk:13-jdk -COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ +COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty diff --git a/9.4-jre11-slim/Dockerfile b/9.4-jre11-slim/Dockerfile index 2cef2e5..9d29b4d 100644 --- a/9.4-jre11-slim/Dockerfile +++ b/9.4-jre11-slim/Dockerfile @@ -1,5 +1,9 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Keys +FROM openjdk:13-jdk AS Jetty94 + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,14 +29,6 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image to import jetty and validate keys -FROM openjdk:13-jdk AS Jetty -COPY --from=Keys /jetty-keys/ /jetty-keys/ - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - RUN set -xe \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ @@ -43,9 +39,9 @@ RUN set -xe \ && sed -i '/jetty-logging/d' etc/jetty.conf \ && rm -fr jetty.tar.gz* -# Start a new image and import jetty +# Start a new image on the target and import jetty FROM openjdk:11-jre-slim -COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ +COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty diff --git a/9.4-jre11/Dockerfile b/9.4-jre11/Dockerfile index 33248c1..f39016a 100644 --- a/9.4-jre11/Dockerfile +++ b/9.4-jre11/Dockerfile @@ -1,5 +1,9 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Keys +FROM openjdk:13-jdk AS Jetty94 + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,14 +29,6 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image to import jetty and validate keys -FROM openjdk:13-jdk AS Jetty -COPY --from=Keys /jetty-keys/ /jetty-keys/ - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - RUN set -xe \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ @@ -43,9 +39,9 @@ RUN set -xe \ && sed -i '/jetty-logging/d' etc/jetty.conf \ && rm -fr jetty.tar.gz* -# Start a new image and import jetty +# Start a new image on the target and import jetty FROM openjdk:11-jre -COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ +COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty diff --git a/9.4-jre8/Dockerfile b/9.4-jre8/Dockerfile index 3c457ee..b029b9a 100644 --- a/9.4-jre8/Dockerfile +++ b/9.4-jre8/Dockerfile @@ -1,5 +1,9 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Keys +FROM openjdk:13-jdk AS Jetty94 + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -25,14 +29,6 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image to import jetty and validate keys -FROM openjdk:13-jdk AS Jetty -COPY --from=Keys /jetty-keys/ /jetty-keys/ - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - RUN set -xe \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ @@ -43,9 +39,9 @@ RUN set -xe \ && sed -i '/jetty-logging/d' etc/jetty.conf \ && rm -fr jetty.tar.gz* -# Start a new image and import jetty +# Start a new image on the target and import jetty FROM openjdk:8-jre -COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ +COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty diff --git a/Dockerfile-9.4 b/Dockerfile-9.4 index efc81d3..e75b0de 100644 --- a/Dockerfile-9.4 +++ b/Dockerfile-9.4 @@ -1,4 +1,8 @@ -FROM openjdk:13-jdk AS Keys +FROM openjdk:13-jdk AS Jetty94 + +ENV JETTY_VERSION 9.4.24.v20191120 +ENV JETTY_HOME /usr/local/jetty +ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) ENV JETTY_GPG_KEYS \ @@ -24,14 +28,6 @@ RUN set -xe \ && for key in $JETTY_GPG_KEYS; do \ GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done -# Start a new image to import jetty and validate keys -FROM openjdk:13-jdk AS Jetty -COPY --from=Keys /jetty-keys/ /jetty-keys/ - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - RUN set -xe \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ @@ -42,9 +38,9 @@ RUN set -xe \ && sed -i '/jetty-logging/d' etc/jetty.conf \ && rm -fr jetty.tar.gz* -# Start a new image and import jetty +# Start a new image on the target and import jetty FROM openjdk:LABEL -COPY --from=Jetty /usr/local/jetty/ /usr/local/jetty/ +COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty From a6aa2347207df58ea653ba120ed958056a9fedf0 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 28 Nov 2019 08:28:04 +1100 Subject: [PATCH 10/12] build jetty-base in base image as well Signed-off-by: Greg Wilkins --- 9.4-jdk13-slim/Dockerfile | 24 +++++++++++++----------- 9.4-jdk13/Dockerfile | 24 +++++++++++++----------- 9.4-jre11-slim/Dockerfile | 24 +++++++++++++----------- 9.4-jre11/Dockerfile | 24 +++++++++++++----------- 9.4-jre8/Dockerfile | 24 +++++++++++++----------- Dockerfile-9.4 | 24 +++++++++++++----------- 6 files changed, 78 insertions(+), 66 deletions(-) diff --git a/9.4-jdk13-slim/Dockerfile b/9.4-jdk13-slim/Dockerfile index 7934057..77a8a50 100644 --- a/9.4-jdk13-slim/Dockerfile +++ b/9.4-jdk13-slim/Dockerfile @@ -3,6 +3,9 @@ FROM openjdk:13-jdk AS Jetty94 ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) @@ -27,9 +30,7 @@ ENV JETTY_GPG_KEYS \ RUN set -xe \ && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done - -RUN set -xe \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ @@ -37,22 +38,26 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* + && rm -fr jetty.tar.gz* \ + && mkdir -p "$JETTY_BASE" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && rm -rf /tmp/hsperfdata_root # Start a new image on the target and import jetty FROM openjdk:13-jdk-slim -COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH +COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME +COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE + RUN set -xe \ + && mkdir -p "$TMPDIR" \ && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_BASE" "$TMPDIR" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ && rm -rf /tmp/hsperfdata_root @@ -64,6 +69,3 @@ EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] -RUN set -xe \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root diff --git a/9.4-jdk13/Dockerfile b/9.4-jdk13/Dockerfile index 7662e0a..b5e56d3 100644 --- a/9.4-jdk13/Dockerfile +++ b/9.4-jdk13/Dockerfile @@ -3,6 +3,9 @@ FROM openjdk:13-jdk AS Jetty94 ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) @@ -27,9 +30,7 @@ ENV JETTY_GPG_KEYS \ RUN set -xe \ && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done - -RUN set -xe \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ @@ -37,22 +38,26 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* + && rm -fr jetty.tar.gz* \ + && mkdir -p "$JETTY_BASE" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && rm -rf /tmp/hsperfdata_root # Start a new image on the target and import jetty FROM openjdk:13-jdk -COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH +COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME +COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE + RUN set -xe \ + && mkdir -p "$TMPDIR" \ && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_BASE" "$TMPDIR" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ && rm -rf /tmp/hsperfdata_root @@ -64,6 +69,3 @@ EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] -RUN set -xe \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root diff --git a/9.4-jre11-slim/Dockerfile b/9.4-jre11-slim/Dockerfile index 9d29b4d..cc47389 100644 --- a/9.4-jre11-slim/Dockerfile +++ b/9.4-jre11-slim/Dockerfile @@ -3,6 +3,9 @@ FROM openjdk:13-jdk AS Jetty94 ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) @@ -27,9 +30,7 @@ ENV JETTY_GPG_KEYS \ RUN set -xe \ && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done - -RUN set -xe \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ @@ -37,22 +38,26 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* + && rm -fr jetty.tar.gz* \ + && mkdir -p "$JETTY_BASE" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && rm -rf /tmp/hsperfdata_root # Start a new image on the target and import jetty FROM openjdk:11-jre-slim -COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH +COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME +COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE + RUN set -xe \ + && mkdir -p "$TMPDIR" \ && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_BASE" "$TMPDIR" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ && rm -rf /tmp/hsperfdata_root @@ -64,6 +69,3 @@ EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] -RUN set -xe \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root diff --git a/9.4-jre11/Dockerfile b/9.4-jre11/Dockerfile index f39016a..3d18d82 100644 --- a/9.4-jre11/Dockerfile +++ b/9.4-jre11/Dockerfile @@ -3,6 +3,9 @@ FROM openjdk:13-jdk AS Jetty94 ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) @@ -27,9 +30,7 @@ ENV JETTY_GPG_KEYS \ RUN set -xe \ && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done - -RUN set -xe \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ @@ -37,22 +38,26 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* + && rm -fr jetty.tar.gz* \ + && mkdir -p "$JETTY_BASE" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && rm -rf /tmp/hsperfdata_root # Start a new image on the target and import jetty FROM openjdk:11-jre -COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH +COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME +COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE + RUN set -xe \ + && mkdir -p "$TMPDIR" \ && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_BASE" "$TMPDIR" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ && rm -rf /tmp/hsperfdata_root @@ -64,6 +69,3 @@ EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] -RUN set -xe \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root diff --git a/9.4-jre8/Dockerfile b/9.4-jre8/Dockerfile index b029b9a..98744cc 100644 --- a/9.4-jre8/Dockerfile +++ b/9.4-jre8/Dockerfile @@ -3,6 +3,9 @@ FROM openjdk:13-jdk AS Jetty94 ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) @@ -27,9 +30,7 @@ ENV JETTY_GPG_KEYS \ RUN set -xe \ && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done - -RUN set -xe \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ @@ -37,22 +38,26 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* + && rm -fr jetty.tar.gz* \ + && mkdir -p "$JETTY_BASE" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && rm -rf /tmp/hsperfdata_root # Start a new image on the target and import jetty FROM openjdk:8-jre -COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH +COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME +COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE + RUN set -xe \ + && mkdir -p "$TMPDIR" \ && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_BASE" "$TMPDIR" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ && rm -rf /tmp/hsperfdata_root @@ -64,6 +69,3 @@ EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] -RUN set -xe \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root diff --git a/Dockerfile-9.4 b/Dockerfile-9.4 index e75b0de..a50dbaa 100644 --- a/Dockerfile-9.4 +++ b/Dockerfile-9.4 @@ -2,6 +2,9 @@ FROM openjdk:13-jdk AS Jetty94 ENV JETTY_VERSION 9.4.24.v20191120 ENV JETTY_HOME /usr/local/jetty +ENV JETTY_BASE /var/lib/jetty +ENV TMPDIR /tmp/jetty +ENV PATH $JETTY_HOME/bin:$PATH ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz # GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) @@ -26,9 +29,7 @@ ENV JETTY_GPG_KEYS \ RUN set -xe \ && mkdir /jetty-keys \ && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done - -RUN set -xe \ + GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ && mkdir -p "$JETTY_HOME" \ && cd $JETTY_HOME \ && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ @@ -36,22 +37,26 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* + && rm -fr jetty.tar.gz* \ + && mkdir -p "$JETTY_BASE" \ + && cd $JETTY_BASE \ + && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ + && rm -rf /tmp/hsperfdata_root # Start a new image on the target and import jetty FROM openjdk:LABEL -COPY --from=Jetty94 /usr/local/jetty/ /usr/local/jetty/ ENV JETTY_HOME /usr/local/jetty ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH +COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME +COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE + RUN set -xe \ + && mkdir -p "$TMPDIR" \ && groupadd -r jetty && useradd -r -g jetty jetty \ - && mkdir -p "$JETTY_BASE" "$TMPDIR" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ && rm -rf /tmp/hsperfdata_root @@ -63,6 +68,3 @@ EXPOSE 8080 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["java","-jar","/usr/local/jetty/start.jar"] -RUN set -xe \ - && chown -R jetty:jetty "$JETTY_BASE" \ - && rm -rf /tmp/hsperfdata_root From d5a72e04a659ddab1b1a343afb834b6bf8137c85 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 28 Nov 2019 09:44:48 +1100 Subject: [PATCH 11/12] alternate approach for #113 to use a base image for 9.4 Signed-off-by: Greg Wilkins --- 9.4-jdk13-slim/Dockerfile | 50 ++------------------------------------- 9.4-jdk13/Dockerfile | 16 +------------ 9.4-jre11-slim/Dockerfile | 50 ++------------------------------------- 9.4-jre11/Dockerfile | 50 ++------------------------------------- 9.4-jre8/Dockerfile | 50 ++------------------------------------- Dockerfile-9.4 | 50 ++------------------------------------- Makefile | 5 ++++ update.sh | 2 +- 8 files changed, 17 insertions(+), 256 deletions(-) diff --git a/9.4-jdk13-slim/Dockerfile b/9.4-jdk13-slim/Dockerfile index 77a8a50..87ba9de 100644 --- a/9.4-jdk13-slim/Dockerfile +++ b/9.4-jdk13-slim/Dockerfile @@ -1,50 +1,4 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Jetty94 - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - -# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) -ENV JETTY_GPG_KEYS \ - # Jan Bartel - AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ - # Jesse McConnell - 2A684B57436A81FA8706B53C61C3351A438A3B7D \ - # Joakim Erdfelt - 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ - # Joakim Erdfelt - B59B67FD7904984367F931800818D9D68FB67BAC \ - # Joakim Erdfelt - BFBB21C246D7776836287A48A04E0C74ABB35FEA \ - # Simone Bordet - 8B096546B1A8F02656B15D3B1677D141BCF3584D \ - # Greg Wilkins - FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ - # Greg Wilkins - 5C9579B3DB2E506429319AAEF33B071B29559E1E - -RUN set -xe \ - && mkdir /jetty-keys \ - && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && mkdir -p "$JETTY_HOME" \ - && cd $JETTY_HOME \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* \ - && mkdir -p "$JETTY_BASE" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && rm -rf /tmp/hsperfdata_root - -# Start a new image on the target and import jetty FROM openjdk:13-jdk-slim ENV JETTY_HOME /usr/local/jetty @@ -52,8 +6,8 @@ ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH -COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME -COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE +COPY --from=jetty:9.4-jdk13 $JETTY_HOME $JETTY_HOME +COPY --from=jetty:9.4-jdk13 $JETTY_BASE $JETTY_BASE RUN set -xe \ && mkdir -p "$TMPDIR" \ diff --git a/9.4-jdk13/Dockerfile b/9.4-jdk13/Dockerfile index b5e56d3..e23aac0 100644 --- a/9.4-jdk13/Dockerfile +++ b/9.4-jdk13/Dockerfile @@ -38,24 +38,10 @@ RUN set -xe \ && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ && tar -xvf jetty.tar.gz --strip-components=1 \ && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* \ + && rm -fr jetty.tar.gz* /jetty-keys \ && mkdir -p "$JETTY_BASE" \ && cd $JETTY_BASE \ && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && rm -rf /tmp/hsperfdata_root - -# Start a new image on the target and import jetty -FROM openjdk:13-jdk - -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH - -COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME -COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE - -RUN set -xe \ && mkdir -p "$TMPDIR" \ && groupadd -r jetty && useradd -r -g jetty jetty \ && chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" \ diff --git a/9.4-jre11-slim/Dockerfile b/9.4-jre11-slim/Dockerfile index cc47389..cef2d9f 100644 --- a/9.4-jre11-slim/Dockerfile +++ b/9.4-jre11-slim/Dockerfile @@ -1,50 +1,4 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Jetty94 - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - -# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) -ENV JETTY_GPG_KEYS \ - # Jan Bartel - AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ - # Jesse McConnell - 2A684B57436A81FA8706B53C61C3351A438A3B7D \ - # Joakim Erdfelt - 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ - # Joakim Erdfelt - B59B67FD7904984367F931800818D9D68FB67BAC \ - # Joakim Erdfelt - BFBB21C246D7776836287A48A04E0C74ABB35FEA \ - # Simone Bordet - 8B096546B1A8F02656B15D3B1677D141BCF3584D \ - # Greg Wilkins - FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ - # Greg Wilkins - 5C9579B3DB2E506429319AAEF33B071B29559E1E - -RUN set -xe \ - && mkdir /jetty-keys \ - && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && mkdir -p "$JETTY_HOME" \ - && cd $JETTY_HOME \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* \ - && mkdir -p "$JETTY_BASE" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && rm -rf /tmp/hsperfdata_root - -# Start a new image on the target and import jetty FROM openjdk:11-jre-slim ENV JETTY_HOME /usr/local/jetty @@ -52,8 +6,8 @@ ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH -COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME -COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE +COPY --from=jetty:9.4-jdk13 $JETTY_HOME $JETTY_HOME +COPY --from=jetty:9.4-jdk13 $JETTY_BASE $JETTY_BASE RUN set -xe \ && mkdir -p "$TMPDIR" \ diff --git a/9.4-jre11/Dockerfile b/9.4-jre11/Dockerfile index 3d18d82..17032c1 100644 --- a/9.4-jre11/Dockerfile +++ b/9.4-jre11/Dockerfile @@ -1,50 +1,4 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Jetty94 - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - -# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) -ENV JETTY_GPG_KEYS \ - # Jan Bartel - AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ - # Jesse McConnell - 2A684B57436A81FA8706B53C61C3351A438A3B7D \ - # Joakim Erdfelt - 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ - # Joakim Erdfelt - B59B67FD7904984367F931800818D9D68FB67BAC \ - # Joakim Erdfelt - BFBB21C246D7776836287A48A04E0C74ABB35FEA \ - # Simone Bordet - 8B096546B1A8F02656B15D3B1677D141BCF3584D \ - # Greg Wilkins - FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ - # Greg Wilkins - 5C9579B3DB2E506429319AAEF33B071B29559E1E - -RUN set -xe \ - && mkdir /jetty-keys \ - && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && mkdir -p "$JETTY_HOME" \ - && cd $JETTY_HOME \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* \ - && mkdir -p "$JETTY_BASE" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && rm -rf /tmp/hsperfdata_root - -# Start a new image on the target and import jetty FROM openjdk:11-jre ENV JETTY_HOME /usr/local/jetty @@ -52,8 +6,8 @@ ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH -COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME -COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE +COPY --from=jetty:9.4-jdk13 $JETTY_HOME $JETTY_HOME +COPY --from=jetty:9.4-jdk13 $JETTY_BASE $JETTY_BASE RUN set -xe \ && mkdir -p "$TMPDIR" \ diff --git a/9.4-jre8/Dockerfile b/9.4-jre8/Dockerfile index 98744cc..3628ee7 100644 --- a/9.4-jre8/Dockerfile +++ b/9.4-jre8/Dockerfile @@ -1,50 +1,4 @@ # DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh -FROM openjdk:13-jdk AS Jetty94 - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - -# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) -ENV JETTY_GPG_KEYS \ - # Jan Bartel - AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ - # Jesse McConnell - 2A684B57436A81FA8706B53C61C3351A438A3B7D \ - # Joakim Erdfelt - 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ - # Joakim Erdfelt - B59B67FD7904984367F931800818D9D68FB67BAC \ - # Joakim Erdfelt - BFBB21C246D7776836287A48A04E0C74ABB35FEA \ - # Simone Bordet - 8B096546B1A8F02656B15D3B1677D141BCF3584D \ - # Greg Wilkins - FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ - # Greg Wilkins - 5C9579B3DB2E506429319AAEF33B071B29559E1E - -RUN set -xe \ - && mkdir /jetty-keys \ - && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && mkdir -p "$JETTY_HOME" \ - && cd $JETTY_HOME \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* \ - && mkdir -p "$JETTY_BASE" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && rm -rf /tmp/hsperfdata_root - -# Start a new image on the target and import jetty FROM openjdk:8-jre ENV JETTY_HOME /usr/local/jetty @@ -52,8 +6,8 @@ ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH -COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME -COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE +COPY --from=jetty:9.4-jdk13 $JETTY_HOME $JETTY_HOME +COPY --from=jetty:9.4-jdk13 $JETTY_BASE $JETTY_BASE RUN set -xe \ && mkdir -p "$TMPDIR" \ diff --git a/Dockerfile-9.4 b/Dockerfile-9.4 index a50dbaa..4433218 100644 --- a/Dockerfile-9.4 +++ b/Dockerfile-9.4 @@ -1,49 +1,3 @@ -FROM openjdk:13-jdk AS Jetty94 - -ENV JETTY_VERSION 9.4.24.v20191120 -ENV JETTY_HOME /usr/local/jetty -ENV JETTY_BASE /var/lib/jetty -ENV TMPDIR /tmp/jetty -ENV PATH $JETTY_HOME/bin:$PATH -ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz - -# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt) -ENV JETTY_GPG_KEYS \ - # Jan Bartel - AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \ - # Jesse McConnell - 2A684B57436A81FA8706B53C61C3351A438A3B7D \ - # Joakim Erdfelt - 5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \ - # Joakim Erdfelt - B59B67FD7904984367F931800818D9D68FB67BAC \ - # Joakim Erdfelt - BFBB21C246D7776836287A48A04E0C74ABB35FEA \ - # Simone Bordet - 8B096546B1A8F02656B15D3B1677D141BCF3584D \ - # Greg Wilkins - FBA2B18D238AB852DF95745C76157BDF03D0DCD6 \ - # Greg Wilkins - 5C9579B3DB2E506429319AAEF33B071B29559E1E - -RUN set -xe \ - && mkdir /jetty-keys \ - && for key in $JETTY_GPG_KEYS; do \ - GNUPGHOME=/jetty-keys gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; done \ - && mkdir -p "$JETTY_HOME" \ - && cd $JETTY_HOME \ - && curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz \ - && curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc \ - && GNUPGHOME=/jetty-keys gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz \ - && tar -xvf jetty.tar.gz --strip-components=1 \ - && sed -i '/jetty-logging/d' etc/jetty.conf \ - && rm -fr jetty.tar.gz* \ - && mkdir -p "$JETTY_BASE" \ - && cd $JETTY_BASE \ - && java -jar "$JETTY_HOME/start.jar" --create-startd --add-to-start="server,http,deploy,jsp,jstl,ext,resources,websocket" \ - && rm -rf /tmp/hsperfdata_root - -# Start a new image on the target and import jetty FROM openjdk:LABEL ENV JETTY_HOME /usr/local/jetty @@ -51,8 +5,8 @@ ENV JETTY_BASE /var/lib/jetty ENV TMPDIR /tmp/jetty ENV PATH $JETTY_HOME/bin:$PATH -COPY --from=Jetty94 $JETTY_HOME $JETTY_HOME -COPY --from=Jetty94 $JETTY_BASE $JETTY_BASE +COPY --from=jetty:9.4-jdk13 $JETTY_HOME $JETTY_HOME +COPY --from=jetty:9.4-jdk13 $JETTY_BASE $JETTY_BASE RUN set -xe \ && mkdir -p "$TMPDIR" \ diff --git a/Makefile b/Makefile index 4398eca..2639afc 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,11 @@ $1: endef $(foreach version,$(VERSIONS),$(eval $(call jetty-version,$(version)))) +9.4-jdk13-slim: 9.4-jdk13 +9.4-jre11: 9.4-jdk13 +9.4-jre11-slim: 9.4-jdk13 +9.4-jre8: 9.4-jdk13 + update: docker run --rm -v $$(pwd):/work -w /work buildpack-deps ./update.sh diff --git a/update.sh b/update.sh index e482d66..8d0cdd0 100755 --- a/update.sh +++ b/update.sh @@ -51,7 +51,7 @@ for path in "${paths[@]}"; do if [ -d "$path" ]; then cp docker-entrypoint.sh generate-jetty-start.sh "$path" - if [ "$version" == "9.4" ] ; then + if [ "$version" == "9.4" -a "$jvm" != "jdk13" ] ; then echo '# DO NOT EDIT. Edit Dockerfile-9.4 and use update.sh' > "$path"/Dockerfile cat Dockerfile-9.4 >> "$path"/Dockerfile sed -ri 's/^(FROM openjdk:)LABEL/\1'"$label"'/; ' "$path/Dockerfile" From ffc22db87e52047bc28a5d797255fb784842ec4d Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 28 Nov 2019 10:12:33 +1100 Subject: [PATCH 12/12] fix ordering of images Signed-off-by: Greg Wilkins --- generate-stackbrew-library.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index b697e9b..e4c1122 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -10,8 +10,8 @@ defaultJdk="jdk13" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -paths=( **/*/Dockerfile ) -paths=( $( printf '%s\n' "${paths[@]%/Dockerfile}" | sort -t/ -k 1,1Vr -k 2,2 ) ) +paths=( **/Dockerfile ) +paths=( $( printf '%s\n' "${paths[@]%/Dockerfile}" | sort -k 1.1,1.3Vr -k 1,8 ) ) url='https://github.com/appropriate/docker-jetty.git' cat <<-EOH @@ -36,9 +36,14 @@ addTag() { for path in "${paths[@]}"; do tags=() - directory="$path" - commit="$(git log -1 --format='format:%H' -- "$directory")" - version="$(grep -m1 'ENV JETTY_VERSION ' "$directory/Dockerfile" | cut -d' ' -f3)" + commit="$(git log -1 --format='format:%H' -- "$path")" + + major="${path%%-*}" # "9.2" + if [[ "$major" == "9.4" ]]; then + version="$(grep -m1 'ENV JETTY_VERSION ' "9.4-jdk13/Dockerfile" | cut -d' ' -f3)" + else + version="$(grep -m1 'ENV JETTY_VERSION ' "$path/Dockerfile" | cut -d' ' -f3)" + fi # Determine the JDK jdk=${path#*-} # "jre7" @@ -82,8 +87,8 @@ for path in "${paths[@]}"; do cat <<-EOE Tags:$(IFS=, ; echo "${tags[*]/#/ }") - Architectures: $(< "$directory/arches") - Directory: $directory + Architectures: $(< "$path/arches") + Directory: $path GitCommit: $commit EOE done