From a40c1c364a714ac77f442d5e473ab2d4ce705f8a Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Thu, 28 Sep 2023 15:38:33 -0700 Subject: [PATCH] Adjust template for al2023 --- Dockerfile.template | 47 ++++++++++++++++++++++++++++++--------------- shared.jq | 10 +++++++++- versions.json | 19 ++++++++++++++++-- versions.sh | 2 +- 4 files changed, 59 insertions(+), 19 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index d553a0f2e..42b89326f 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -94,13 +94,15 @@ RUN set -eux; \ gnupg \ ; \ {{ ) else ( -}} +{{ if is_yum then ( -}} # http://yum.baseurl.org/wiki/YumDB.html if ! command -v yumdb > /dev/null; then \ yum install -y --setopt=skip_missing_names_on_install=False yum-utils; \ yumdb set reason dep yum-utils; \ fi; \ -# a helper function to "yum install" things, but only if they aren't installed (and to set their "reason" to "dep" so "yum autoremove" can purge them for us) - _yum_install_temporary() { ( set -eu +x; \ +{{ ) else "" end -}} +# a helper function to install things, but only if they aren't installed (and to set their "reason" to "dep" so "autoremove" can purge them for us) + _install_temporary() { ( set -eu +x; \ local pkg todo=''; \ for pkg; do \ if ! rpm --query "$pkg" > /dev/null 2>&1; then \ @@ -109,11 +111,21 @@ RUN set -eux; \ done; \ if [ -n "$todo" ]; then \ set -x; \ +{{ if is_yum then ( -}} yum install -y --setopt=skip_missing_names_on_install=False $todo; \ yumdb set reason dep $todo; \ +{{ ) else ( -}} + dnf install -y $todo; \ + dnf mark remove $todo; \ +{{ ) end -}} fi; \ ) }; \ - _yum_install_temporary gzip tar; \ + _install_temporary gzip tar; \ +{{ if vendor_variant | contains("al20") then ( -}} +# gnupg2-minimal (installed by default) conflicts with gnupg2 and does not include dirmngr so cannot fetch keys + dnf install -y --allowerasing gnupg2; \ +{{ ) else "" end -}} + {{ ) end -}} \ ddist() { \ @@ -173,11 +185,16 @@ RUN set -eux; \ make \ ; \ {{ ) else ( -}} - _yum_install_temporary \ + _install_temporary \ apr-devel \ + findutils \ gcc \ make \ +{{ if vendor_variant | variant_is_al2 then ( -}} openssl11-devel \ +{{ ) else ( -}} + openssl-devel \ +{{ ) end -}} ; \ {{ ) end -}} ( \ @@ -206,6 +223,10 @@ RUN set -eux; \ rm -rf "$nativeBuildDir"; \ rm bin/tomcat-native.tar.gz; \ \ +# sh removes env vars it doesn't support (ones with periods) +# https://github.com/docker-library/tomcat/issues/77 + find ./bin/ -name '*.sh' -exec sed -ri 's|^#!/bin/sh$|#!/usr/bin/env bash|' '{}' +; \ + \ {{ if is_apt then ( -}} # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies apt-mark auto '.*' > /dev/null; \ @@ -232,19 +253,15 @@ RUN set -eux; \ | xargs -rt rpm --query --whatprovides \ | sort -u \ | tee "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt" \ - | xargs -r yumdb set reason user \ + | xargs -r {{ if is_yum then "yumdb set reason user" else "dnf mark install" end }} \ ; \ \ # clean up anything added temporarily and not later marked as necessary - yum autoremove -y; \ - yum clean all; \ - rm -rf /var/cache/yum; \ + {{ if is_yum then "yum" else "dnf" end }} autoremove -y; \ + {{ if is_yum then "yum" else "dnf" end }} clean all; \ + rm -rf /var/cache/{{ if is_yum then "yum" else "dnf" end }}; \ {{ ) end -}} \ -# sh removes env vars it doesn't support (ones with periods) -# https://github.com/docker-library/tomcat/issues/77 - find ./bin/ -name '*.sh' -exec sed -ri 's|^#!/bin/sh$|#!/usr/bin/env bash|' '{}' +; \ - \ # fix permissions (especially for running as non-root) # https://github.com/docker-library/tomcat/issues/35 chmod -R +rX .; \ @@ -260,9 +277,9 @@ RUN set -eux; \ xargs -rt apt-get install -y --no-install-recommends < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \ rm -rf /var/lib/apt/lists/* {{ ) else ( -}} - xargs -rt yum install -y --setopt=skip_missing_names_on_install=False < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \ - yum clean all; \ - rm -rf /var/cache/yum + xargs -rt {{ if is_yum then "yum" else "dnf" end }} install -y{{ if is_yum then " --setopt=skip_missing_names_on_install=False" else "" end }} < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \ + {{ if is_yum then "yum" else "dnf" end }} clean all; \ + rm -rf /var/cache/{{ if is_yum then "yum" else "dnf" end }} {{ ) end -}} {{ ) end -}} diff --git a/shared.jq b/shared.jq index 413bbbecd..11c6f4a10 100644 --- a/shared.jq +++ b/shared.jq @@ -18,6 +18,14 @@ def is_supported_java_version(java): java >= 7 end ; +def variant_is_al2: # NOT al20XX + contains("al2") and (contains("al20") | not) +; +def is_yum: + vendor_variant | ( + variant_is_al2 + ) +; def is_apt: vendor_variant | ( contains("al2") @@ -33,7 +41,7 @@ def has_openssl_ge_3(variant): # https://github.com/apache/tomcat-native/commit/f7930fa16f095717cfc641a8d24e60c343765adc variant | ( # amazonlinux - contains("al2") # corretto + variant_is_al2 # corretto # debian or contains("bullseye") # openjdk or contains("buster") # openjdk diff --git a/versions.json b/versions.json index 78fb7b3e1..19a0c0c5d 100644 --- a/versions.json +++ b/versions.json @@ -2,36 +2,46 @@ "10.1": { "sha512": "406c0c367ac6ad95bb724ecc3a3c340ad7ded8c62287d657811eeec496eaaca1f5add52d2f46111da1426ae67090c543f6deccfeb5fdf4bdae32f9b39e773265", "variants": [ + "jdk21/corretto-al2023", "jdk17/temurin-jammy", "jre17/temurin-jammy", + "jdk17/corretto-al2023", "jdk11/temurin-jammy", - "jre11/temurin-jammy" + "jre11/temurin-jammy", + "jdk11/corretto-al2023" ], "version": "10.1.13" }, "11.0": { "sha512": "0404346b353030f776448af8ae4495d45c4c73c27bf9a9bfa5c53508ec51b0200e93e21f5526a28856639127fc20cc546e880908ef182b1653e5fd5ddb056fc5", - "variants": [], + "variants": [ + "jdk21/corretto-al2023" + ], "version": "11.0.0-M11" }, "8.5": { "sha512": "fdd9bd768c2c8b7f57c75f1a4863bd2bde55e8ea7c8b9cb81427ea8be652540bdcb1ff1cd625b9fb0dd48eb750ebef0f0244d12ac574998d5df3a0d339699bcc", "variants": [ + "jdk21/corretto-al2023", "jdk21/corretto-al2", "jdk17/temurin-jammy", "jre17/temurin-jammy", "jdk17/temurin-focal", "jre17/temurin-focal", + "jdk17/corretto-al2023", "jdk17/corretto-al2", "jdk11/temurin-jammy", "jre11/temurin-jammy", "jdk11/temurin-focal", "jre11/temurin-focal", + "jdk11/corretto-al2023", "jdk11/corretto-al2", "jdk8/temurin-jammy", "jre8/temurin-jammy", "jdk8/temurin-focal", "jre8/temurin-focal", + "jdk8/corretto-al2023", + "jre8/corretto-al2023", "jdk8/corretto-al2" ], "version": "8.5.93" @@ -39,21 +49,26 @@ "9.0": { "sha512": "24014441b0ccdd2dda238efa56e1a039476488943e6cf04f8a372a340a49dd21ce174ed68e2f5fcc43401e85fae6d00c5eac3d357653e91601737b6fa94476de", "variants": [ + "jdk21/corretto-al2023", "jdk21/corretto-al2", "jdk17/temurin-jammy", "jre17/temurin-jammy", "jdk17/temurin-focal", "jre17/temurin-focal", + "jdk17/corretto-al2023", "jdk17/corretto-al2", "jdk11/temurin-jammy", "jre11/temurin-jammy", "jdk11/temurin-focal", "jre11/temurin-focal", + "jdk11/corretto-al2023", "jdk11/corretto-al2", "jdk8/temurin-jammy", "jre8/temurin-jammy", "jdk8/temurin-focal", "jre8/temurin-focal", + "jdk8/corretto-al2023", + "jre8/corretto-al2023", "jdk8/corretto-al2" ], "version": "9.0.80" diff --git a/versions.sh b/versions.sh index d76818f38..a2f715649 100755 --- a/versions.sh +++ b/versions.sh @@ -31,7 +31,7 @@ for javaVersion in 21 17 11 8; do for vendorVariant in \ temurin-{jammy,focal} \ openjdk{,-slim}-{bookworm,bullseye,buster} \ - corretto-al2 \ + corretto-al2023 corretto-al2 \ ; do for javaVariant in {jdk,jre}"$javaVersion"; do export variant="$javaVariant/$vendorVariant"