From d6d379cb90fafcb676055ccf1fbf861e98e5d4ae Mon Sep 17 00:00:00 2001 From: Jenny Shivayogi Date: Thu, 3 Aug 2023 18:47:46 -0700 Subject: [PATCH 1/5] adding templates for al2,al2-generic and al2023 --- bin/apply-template.py | 60 +++++++++++++++---- templates/al2-generic.Dockerfile.template | 40 +++++++++++++ templates/al2-headful.Dockerfile.template | 26 ++++++++ templates/al2-headless.Dockerfile.template | 26 ++++++++ templates/al2.Dockerfile.template | 54 +++++++++++++++++ templates/al2023-generic.Dockerfile.template | 29 +++++++++ templates/al2023-headful.Dockerfile.template | 24 ++++++++ templates/al2023-headless.Dockerfile.template | 24 ++++++++ templates/al2023.Dockerfile.template | 49 +++++++++++++++ 9 files changed, 321 insertions(+), 11 deletions(-) create mode 100644 templates/al2-generic.Dockerfile.template create mode 100644 templates/al2-headful.Dockerfile.template create mode 100644 templates/al2-headless.Dockerfile.template create mode 100644 templates/al2.Dockerfile.template create mode 100644 templates/al2023-generic.Dockerfile.template create mode 100644 templates/al2023-headful.Dockerfile.template create mode 100644 templates/al2023-headless.Dockerfile.template create mode 100644 templates/al2023.Dockerfile.template diff --git a/bin/apply-template.py b/bin/apply-template.py index 5ffb6af..3b16ede 100644 --- a/bin/apply-template.py +++ b/bin/apply-template.py @@ -11,25 +11,55 @@ def process_template_files(major_version, version, platform): input_parameter = {} input_parameter['CORRETTO_VERSION'] = version input_parameter['MAJOR_VERSION'] = major_version + input_parameter['JDK_VERSION'] = '1.8.0' if platform == 'alpine': # Update .github/workflows/verify-images.yml as well when alpine versions changes - os_versions = ['3.15', '3.16', '3.17', '3.18'] + os_versions = ['3.15', '3.16', '3.17', '3.18'] try: shutil.rmtree(f"{major_version}/jdk/{platform}") shutil.rmtree(f"{major_version}/jre/{platform}") except: pass - for os_version in os_versions: - input_parameter['OS_VERSION'] = os_version - os.makedirs(f"{major_version}/jdk/{platform}/{os_version}/", exist_ok=True) - with open(f"{major_version}/jdk/{platform}/{os_version}/Dockerfile", 'w') as output: - output.write(template.render(**input_parameter)) + if platform == 'alpine': + for os_version in os_versions: + input_parameter['OS_VERSION'] = os_version + os.makedirs(f"{major_version}/jdk/{platform}/{os_version}/", exist_ok=True) + with open(f"{major_version}/jdk/{platform}/{os_version}/Dockerfile", 'w') as output: + output.write(template.render(**input_parameter)) + + if major_version == '8': + os.makedirs(f"{major_version}/jre/{platform}/{os_version}/", exist_ok=True) + with open(f"{major_version}/jre/{platform}/{os_version}/Dockerfile", 'w') as output: + output.write(template.render(**input_parameter, **{'jre':True})) + + elif 'headless' in platform or 'headful' in platform: + head_variant = 'headless' if 'headless' in platform else 'headful' + if major_version==11 or major_version==17: + os.makedirs(f"{major_version}/{head_variant}/{platform}/", exist_ok=True) + with open(f"{major_version}/{head_variant}/{platform}/Dockerfile", 'w') as output: + output.write(template.render(**input_parameter)) + + elif platform == 'al2023-generic': + if major_version==20: + os.makedirs(f"{major_version}/jdk/{platform}/", exist_ok=True) + with open(f"{major_version}/{head_variant}/{platform}/Dockerfile", 'w') as output: + output.write(template.render(**input_parameter)) + + else: + os.makedirs(f"{major_version}/jdk/{platform}/", exist_ok=True) + with open(f"{major_version}/jdk/{platform}/Dockerfile", 'w') as output: + if major_version == '8': + output.write(template.render(**input_parameter, **{'version_8':True})) + elif major_version == '11': + output.write(template.render(**input_parameter, **{'version_11':True})) + else: + output.write(template.render(**input_parameter)) + + if major_version == '8' and platform != 'al2-generic': + os.makedirs(f"{major_version}/jre/{platform}/", exist_ok=True) + with open(f"{major_version}/jre/{platform}/Dockerfile", 'w') as output: + output.write(template.render(**input_parameter, **{'jre':True, 'version_8':True})) - - if major_version == '8': - os.makedirs(f"{major_version}/jre/{platform}/{os_version}/", exist_ok=True) - with open(f"{major_version}/jre/{platform}/{os_version}/Dockerfile", 'w') as output: - output.write(template.render(**input_parameter, **{'jre':True})) def main(): with open('versions.json','r') as version_file: @@ -37,6 +67,14 @@ def main(): for key in versions: process_template_files(key, versions[key], 'alpine') + process_template_files(key, versions[key], 'al2') + process_template_files(key, versions[key], 'al2-generic') + process_template_files(key, versions[key], 'al2-headful') + process_template_files(key, versions[key], 'al2-headless') + process_template_files(key, versions[key], 'al2023') + process_template_files(key, versions[key], 'al2023-generic') + process_template_files(key, versions[key], 'al2023-headful') + process_template_files(key, versions[key], 'al2023-headless') if __name__ == "__main__": main() diff --git a/templates/al2-generic.Dockerfile.template b/templates/al2-generic.Dockerfile.template new file mode 100644 index 0000000..bdedf9b --- /dev/null +++ b/templates/al2-generic.Dockerfile.template @@ -0,0 +1,40 @@ +FROM amazonlinux:2 +{%if version_8 %} +ARG version={{JDK_VERSION}} +{% else %} +ARG version={{CORRETTO_VERSION}} +{% endif %} +# In addition to installing the Amazon corretto, we also install +# fontconfig. The folks who manage the docker hub's +# official image library have found that font management +# is a common usecase, and painpoint, and have +# recommended that Java images include font support. +# +# See: +# https://github.com/docker-library/official-images/blob/master/test/tests/java-uimanager-font/container.java + +# The logic and code related to Fingerprint is contributed by @tianon in a Github PR's Conversation +# Comment = https://github.com/docker-library/official-images/pull/7459#issuecomment-592242757 +# PR = https://github.com/docker-library/official-images/pull/7459 +RUN set -eux \ + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fL -o corretto.key https://yum.corretto.aws/corretto.key \ + && gpg --batch --import corretto.key \ + && gpg --batch --export --armor '6DC3636DAE534049C8B94623A122542AB04F24E3' > corretto.key \ + && rpm --import corretto.key \ + && rm -r "$GNUPGHOME" corretto.key \ + && curl -fL -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \ + && grep -q '^gpgcheck=1' /etc/yum.repos.d/corretto.repo \ + && echo "priority=9" >> /etc/yum.repos.d/corretto.repo \ + {% if version_8 %} + && yum install -y java-{{JDK_VERSION}}-amazon-corretto-devel-$version \ + && (find /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto -name src.zip -delete || true) \ + {% else %} + && yum install -y java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version \ + && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -name src.zip -delete || true) \ + {% endif %} + && yum install -y fontconfig \ + && yum clean all + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto diff --git a/templates/al2-headful.Dockerfile.template b/templates/al2-headful.Dockerfile.template new file mode 100644 index 0000000..f62e47c --- /dev/null +++ b/templates/al2-headful.Dockerfile.template @@ -0,0 +1,26 @@ +FROM amazonlinux:2 + +ARG version={{CORRETTO_VERSION}} + +RUN set -eux \ + && export resouce_version=$(echo $version | tr '-' '.') \ + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.1.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file diff --git a/templates/al2-headless.Dockerfile.template b/templates/al2-headless.Dockerfile.template new file mode 100644 index 0000000..c8e139a --- /dev/null +++ b/templates/al2-headless.Dockerfile.template @@ -0,0 +1,26 @@ +FROM amazonlinux:2 + +ARG version={{CORRETTO_VERSION}} + +RUN set -eux \ + && export resouce_version=$(echo $version | tr '-' '.') \ + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file diff --git a/templates/al2.Dockerfile.template b/templates/al2.Dockerfile.template new file mode 100644 index 0000000..d73b050 --- /dev/null +++ b/templates/al2.Dockerfile.template @@ -0,0 +1,54 @@ +FROM amazonlinux:2 +{% if version_8 %} +ARG version={{JDK_VERSION}} +{% else %} +ARG version={{CORRETTO_VERSION}} +{% endif %} + +RUN set -eux \ + {%if version_8 %} + && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ + {% else %} + && export resouce_version=$(echo $version | tr '-' '.') \ + {% endif %} + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + {% if jre %} + && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ + {% elif version_8 %} + && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm" "java-{{JDK_VERSION}}-amazon-corretto-devel-$version.amzn2.$(uname -m).rpm") \ + {% elif version_11 %} + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ + {% else %} + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2.1.$(uname -m).rpm") \ + {% endif %} + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + {% if jre %} + && echo $(rpm -K "${CORRETO_TEMP}/${rpm}") \ + {% endif %} + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && if [[ ${rpm} != *jmods* ]]; then \ + yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + fi; \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + {%if version_8 %} + && (find /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m) -name "*src.zip" -delete || true) \ + {% else %} + && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + {% endif %} + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +{%if jre %} +ENV JAVA_HOME=/usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto/jre +{% else %} +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto +{% endif %} \ No newline at end of file diff --git a/templates/al2023-generic.Dockerfile.template b/templates/al2023-generic.Dockerfile.template new file mode 100644 index 0000000..740a617 --- /dev/null +++ b/templates/al2023-generic.Dockerfile.template @@ -0,0 +1,29 @@ +FROM amazonlinux:2023 + +ARG version={{CORRETTO_VERSION}} +# In addition to installing the Amazon corretto, we also install +# libs that are needed for jdk to be functional + +# The logic and code related to Fingerprint is contributed by @tianon in a Github PR's Conversation +# Comment = https://github.com/docker-library/official-images/pull/7459#issuecomment-592242757 +# PR = https://github.com/docker-library/official-images/pull/7459 +RUN set -eux \ + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fL -o corretto.key https://yum.corretto.aws/corretto.key \ + && dnf install gnupg2 -y --allowerasing \ + && dnf install findutils -y \ + && gpg --batch --import corretto.key \ + && gpg --batch --export --armor '6DC3636DAE534049C8B94623A122542AB04F24E3' > corretto.key \ + && rpm --import corretto.key \ + && rm -r "$GNUPGHOME" corretto.key \ + && curl -fL -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \ + && grep -q '^gpgcheck=1' /etc/yum.repos.d/corretto.repo \ + && echo "priority=9" >> /etc/yum.repos.d/corretto.repo \ + && dnf install -y java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version \ + && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -name src.zip -delete || true) \ + && dnf remove -y findutils \ + && dnf install -y fontconfig freetype libjpeg dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts libjpeg \ + && dnf clean all + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file diff --git a/templates/al2023-headful.Dockerfile.template b/templates/al2023-headful.Dockerfile.template new file mode 100644 index 0000000..ea5f5af --- /dev/null +++ b/templates/al2023-headful.Dockerfile.template @@ -0,0 +1,24 @@ +FROM amazonlinux:2023 + +ARG version={{CORRETTO_VERSION}} +ARG package_version=1 + +RUN set -eux \ + && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ + && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ + done \ + && dnf install -y ${CORRETO_TEMP}/*.rpm \ + && popd \ + && rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ + && rm -rf ${CORRETO_TEMP} \ + && dnf clean all \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto diff --git a/templates/al2023-headless.Dockerfile.template b/templates/al2023-headless.Dockerfile.template new file mode 100644 index 0000000..2a9d711 --- /dev/null +++ b/templates/al2023-headless.Dockerfile.template @@ -0,0 +1,24 @@ +FROM amazonlinux:{{OS_VERSION}} + +ARG version={{CORRETTO_VERSION}} +ARG package_version=1 + +RUN set -eux \ + && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ + && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ + done \ + && dnf install -y ${CORRETO_TEMP}/*.rpm \ + && popd \ + && rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ + && rm -rf ${CORRETO_TEMP} \ + && dnf clean all \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file diff --git a/templates/al2023.Dockerfile.template b/templates/al2023.Dockerfile.template new file mode 100644 index 0000000..662c13d --- /dev/null +++ b/templates/al2023.Dockerfile.template @@ -0,0 +1,49 @@ +FROM amazonlinux:2023 +{% if version_8 %} +ARG version={{JDK_VERSION}} +{% else %} +ARG version={{CORRETTO_VERSION}} +{% endif %} +ARG package_version=1 + +RUN set -eux \ + {%if version_8 %} + && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ + {% endif %} + && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ + && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + {% if jre %} + && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ + {% elif version_8 %} + && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2023.$(uname -m).rpm" "java-{{JDK_VERSION}}-amazon-corretto-devel-$version.amzn2023.$(uname -m).rpm") \ + {% else %} + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2023.${package_version}.$(uname -m).rpm") \ + {% endif %} + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ + done \ + && dnf install -y ${CORRETO_TEMP}/*.rpm \ + {% if jre %} + && alternatives --install /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto java-{{JDK_VERSION}}-amazon-corretto /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m) 100 \ + && popd \ + {%if version_8 %} + && rm -rf /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ + {% else %} + && rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ + {% endif %} + && rm -rf ${CORRETO_TEMP} \ + && dnf clean all \ + {% if version_8 %} + && rm -rf /var/cache/yum \ + {% endif %} + && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf + +ENV LANG C.UTF-8 +{%if jre %} +ENV JAVA_HOME=/usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto/jre +{% else %} +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto +{% endif %} From e1f95804681f535c527448c83d5ec025aa5f9b49 Mon Sep 17 00:00:00 2001 From: Jenny Shivayogi Date: Thu, 3 Aug 2023 18:54:27 -0700 Subject: [PATCH 2/5] formatting fix --- bin/apply-template.py | 2 +- templates/al2-headful.Dockerfile.template | 2 +- templates/al2-headless.Dockerfile.template | 2 +- templates/al2.Dockerfile.template | 2 +- templates/al2023-generic.Dockerfile.template | 2 +- templates/al2023-headless.Dockerfile.template | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/apply-template.py b/bin/apply-template.py index 3b16ede..c3f1d99 100644 --- a/bin/apply-template.py +++ b/bin/apply-template.py @@ -14,7 +14,7 @@ def process_template_files(major_version, version, platform): input_parameter['JDK_VERSION'] = '1.8.0' if platform == 'alpine': # Update .github/workflows/verify-images.yml as well when alpine versions changes - os_versions = ['3.15', '3.16', '3.17', '3.18'] + os_versions = ['3.15', '3.16', '3.17', '3.18'] try: shutil.rmtree(f"{major_version}/jdk/{platform}") shutil.rmtree(f"{major_version}/jre/{platform}") diff --git a/templates/al2-headful.Dockerfile.template b/templates/al2-headful.Dockerfile.template index f62e47c..eb896b8 100644 --- a/templates/al2-headful.Dockerfile.template +++ b/templates/al2-headful.Dockerfile.template @@ -23,4 +23,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto diff --git a/templates/al2-headless.Dockerfile.template b/templates/al2-headless.Dockerfile.template index c8e139a..008de20 100644 --- a/templates/al2-headless.Dockerfile.template +++ b/templates/al2-headless.Dockerfile.template @@ -23,4 +23,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto diff --git a/templates/al2.Dockerfile.template b/templates/al2.Dockerfile.template index d73b050..fcb4e74 100644 --- a/templates/al2.Dockerfile.template +++ b/templates/al2.Dockerfile.template @@ -51,4 +51,4 @@ ENV LANG C.UTF-8 ENV JAVA_HOME=/usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto/jre {% else %} ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -{% endif %} \ No newline at end of file +{% endif %} diff --git a/templates/al2023-generic.Dockerfile.template b/templates/al2023-generic.Dockerfile.template index 740a617..5e23d89 100644 --- a/templates/al2023-generic.Dockerfile.template +++ b/templates/al2023-generic.Dockerfile.template @@ -26,4 +26,4 @@ RUN set -eux \ && dnf clean all ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto diff --git a/templates/al2023-headless.Dockerfile.template b/templates/al2023-headless.Dockerfile.template index 2a9d711..c332bd0 100644 --- a/templates/al2023-headless.Dockerfile.template +++ b/templates/al2023-headless.Dockerfile.template @@ -21,4 +21,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto \ No newline at end of file +ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto From ca9108a6aa854a0d568ef1af648fa6c51ac9a806 Mon Sep 17 00:00:00 2001 From: Jenny Shivayogi Date: Fri, 4 Aug 2023 15:52:37 -0700 Subject: [PATCH 3/5] fixing version discrepancies --- bin/apply-template.py | 10 ++-- templates/al2-generic.Dockerfile.template | 19 +++---- templates/al2-headful.Dockerfile.template | 1 - templates/al2-headless.Dockerfile.template | 1 - templates/al2.Dockerfile.template | 47 +++++----------- templates/al2023-generic.Dockerfile.template | 1 - templates/al2023-headless.Dockerfile.template | 2 +- templates/al2023.Dockerfile.template | 53 ++++++------------- 8 files changed, 43 insertions(+), 91 deletions(-) diff --git a/bin/apply-template.py b/bin/apply-template.py index c3f1d99..64f6c42 100644 --- a/bin/apply-template.py +++ b/bin/apply-template.py @@ -9,9 +9,10 @@ def process_template_files(major_version, version, platform): template = templateEnv.get_template(f"{platform}.Dockerfile.template") input_parameter = {} + if major_version == '8' and platform!= 'alpine': + version = '1.8.0' input_parameter['CORRETTO_VERSION'] = version input_parameter['MAJOR_VERSION'] = major_version - input_parameter['JDK_VERSION'] = '1.8.0' if platform == 'alpine': # Update .github/workflows/verify-images.yml as well when alpine versions changes os_versions = ['3.15', '3.16', '3.17', '3.18'] @@ -34,15 +35,16 @@ def process_template_files(major_version, version, platform): elif 'headless' in platform or 'headful' in platform: head_variant = 'headless' if 'headless' in platform else 'headful' - if major_version==11 or major_version==17: + print("executin headless or headful",platform, major_version) + if major_version=='11' or major_version=='17': os.makedirs(f"{major_version}/{head_variant}/{platform}/", exist_ok=True) with open(f"{major_version}/{head_variant}/{platform}/Dockerfile", 'w') as output: output.write(template.render(**input_parameter)) elif platform == 'al2023-generic': - if major_version==20: + if major_version=='20': os.makedirs(f"{major_version}/jdk/{platform}/", exist_ok=True) - with open(f"{major_version}/{head_variant}/{platform}/Dockerfile", 'w') as output: + with open(f"{major_version}/jdk/{platform}/Dockerfile", 'w') as output: output.write(template.render(**input_parameter)) else: diff --git a/templates/al2-generic.Dockerfile.template b/templates/al2-generic.Dockerfile.template index bdedf9b..0ca6b99 100644 --- a/templates/al2-generic.Dockerfile.template +++ b/templates/al2-generic.Dockerfile.template @@ -1,9 +1,6 @@ FROM amazonlinux:2 -{%if version_8 %} -ARG version={{JDK_VERSION}} -{% else %} + ARG version={{CORRETTO_VERSION}} -{% endif %} # In addition to installing the Amazon corretto, we also install # fontconfig. The folks who manage the docker hub's # official image library have found that font management @@ -25,16 +22,14 @@ RUN set -eux \ && rm -r "$GNUPGHOME" corretto.key \ && curl -fL -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \ && grep -q '^gpgcheck=1' /etc/yum.repos.d/corretto.repo \ - && echo "priority=9" >> /etc/yum.repos.d/corretto.repo \ - {% if version_8 %} - && yum install -y java-{{JDK_VERSION}}-amazon-corretto-devel-$version \ - && (find /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto -name src.zip -delete || true) \ - {% else %} + && echo "priority=9" >> /etc/yum.repos.d/corretto.repo \{% if version_8 %} + && yum install -y java-{{CORRETTO_VERSION}}-amazon-corretto-devel-$version \ + && (find /usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto -name src.zip -delete || true) \{% else %} && yum install -y java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version \ - && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -name src.zip -delete || true) \ - {% endif %} + && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -name src.zip -delete || true) \{% endif %} && yum install -y fontconfig \ && yum clean all ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto +{% if version_8 %}ENV JAVA_HOME=/usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto +{% else %}ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto{% endif %} diff --git a/templates/al2-headful.Dockerfile.template b/templates/al2-headful.Dockerfile.template index eb896b8..6dea33b 100644 --- a/templates/al2-headful.Dockerfile.template +++ b/templates/al2-headful.Dockerfile.template @@ -1,7 +1,6 @@ FROM amazonlinux:2 ARG version={{CORRETTO_VERSION}} - RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.') \ && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ diff --git a/templates/al2-headless.Dockerfile.template b/templates/al2-headless.Dockerfile.template index 008de20..b8f0fad 100644 --- a/templates/al2-headless.Dockerfile.template +++ b/templates/al2-headless.Dockerfile.template @@ -1,7 +1,6 @@ FROM amazonlinux:2 ARG version={{CORRETTO_VERSION}} - RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.') \ && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ diff --git a/templates/al2.Dockerfile.template b/templates/al2.Dockerfile.template index fcb4e74..0699aa1 100644 --- a/templates/al2.Dockerfile.template +++ b/templates/al2.Dockerfile.template @@ -1,54 +1,31 @@ FROM amazonlinux:2 -{% if version_8 %} -ARG version={{JDK_VERSION}} -{% else %} + ARG version={{CORRETTO_VERSION}} -{% endif %} RUN set -eux \ - {%if version_8 %} - && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ - {% else %} - && export resouce_version=$(echo $version | tr '-' '.') \ - {% endif %} + {%if version_8 %}&& export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \{% else %}&& export resouce_version=$(echo $version | tr '-' '.') \{% endif %} && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ && CORRETO_TEMP=$(mktemp -d) \ && pushd ${CORRETO_TEMP} \ - {% if jre %} - && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ - {% elif version_8 %} - && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm" "java-{{JDK_VERSION}}-amazon-corretto-devel-$version.amzn2.$(uname -m).rpm") \ - {% elif version_11 %} - && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ - {% else %} - && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2.1.$(uname -m).rpm") \ - {% endif %} + {% if jre %}&& RPM_LIST=("java-{{CORRETTO_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \{% elif version_8 %}&& RPM_LIST=("java-{{CORRETTO_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm" "java-{{CORRETTO_VERSION}}-amazon-corretto-devel-$version.amzn2.$(uname -m).rpm") \{% elif version_11 %}&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \{% else %}&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2.1.$(uname -m).rpm") \{% endif %} && for rpm in ${RPM_LIST[@]}; do \ - curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ - {% if jre %} - && echo $(rpm -K "${CORRETO_TEMP}/${rpm}") \ - {% endif %} - && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \{% if jre %} + && echo $(rpm -K "${CORRETO_TEMP}/${rpm}") \{% endif %} + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \{% if jre %} + done \{% endif %}{% if version_8 %} + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ); \{% else %} && if [[ ${rpm} != *jmods* ]]; then \ yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ - fi; \ - done \ + fi; \{% endif %}{% if not jre %} + done \{% endif %} && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ && popd \ - {%if version_8 %} - && (find /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m) -name "*src.zip" -delete || true) \ - {% else %} - && (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ - {% endif %} + {%if version_8 %}&& (find /usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto.$(uname -m) -name "*src.zip" -delete || true) \{% else %}&& (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \{% endif %} && rm -rf ${CORRETO_TEMP} \ && yum clean all \ && rm -rf /var/cache/yum \ && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf ENV LANG C.UTF-8 -{%if jre %} -ENV JAVA_HOME=/usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto/jre -{% else %} -ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -{% endif %} +{%if jre %}ENV JAVA_HOME=/usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto/jre{% elif version_8 %}ENV JAVA_HOME=/usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto{% else %}ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto{% endif %} diff --git a/templates/al2023-generic.Dockerfile.template b/templates/al2023-generic.Dockerfile.template index 5e23d89..d1d4c1a 100644 --- a/templates/al2023-generic.Dockerfile.template +++ b/templates/al2023-generic.Dockerfile.template @@ -3,7 +3,6 @@ FROM amazonlinux:2023 ARG version={{CORRETTO_VERSION}} # In addition to installing the Amazon corretto, we also install # libs that are needed for jdk to be functional - # The logic and code related to Fingerprint is contributed by @tianon in a Github PR's Conversation # Comment = https://github.com/docker-library/official-images/pull/7459#issuecomment-592242757 # PR = https://github.com/docker-library/official-images/pull/7459 diff --git a/templates/al2023-headless.Dockerfile.template b/templates/al2023-headless.Dockerfile.template index c332bd0..a8736f1 100644 --- a/templates/al2023-headless.Dockerfile.template +++ b/templates/al2023-headless.Dockerfile.template @@ -1,4 +1,4 @@ -FROM amazonlinux:{{OS_VERSION}} +FROM amazonlinux:2023 ARG version={{CORRETTO_VERSION}} ARG package_version=1 diff --git a/templates/al2023.Dockerfile.template b/templates/al2023.Dockerfile.template index 662c13d..f790f1c 100644 --- a/templates/al2023.Dockerfile.template +++ b/templates/al2023.Dockerfile.template @@ -1,49 +1,30 @@ FROM amazonlinux:2023 -{% if version_8 %} -ARG version={{JDK_VERSION}} -{% else %} -ARG version={{CORRETTO_VERSION}} -{% endif %} -ARG package_version=1 -RUN set -eux \ - {%if version_8 %} - && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ - {% endif %} +ARG version={{CORRETTO_VERSION}}{% if not version_8 %} +ARG package_version=1{% endif %} + +RUN set -eux \{%if version_8 %} + && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \{% endif %} && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ && CORRETO_TEMP=$(mktemp -d) \ - && pushd ${CORRETO_TEMP} \ - {% if jre %} - && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ - {% elif version_8 %} - && RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2023.$(uname -m).rpm" "java-{{JDK_VERSION}}-amazon-corretto-devel-$version.amzn2023.$(uname -m).rpm") \ - {% else %} - && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2023.${package_version}.$(uname -m).rpm") \ - {% endif %} + && pushd ${CORRETO_TEMP} \{% if jre %} + && RPM_LIST=("java-{{CORRETTO_VERSION}}-amazon-corretto-$version.amzn2023.$(uname -m).rpm") \{% elif version_8 %} + && RPM_LIST=("java-{{CORRETTO_VERSION}}-amazon-corretto-$version.amzn2023.$(uname -m).rpm" "java-{{CORRETTO_VERSION}}-amazon-corretto-devel-$version.amzn2023.$(uname -m).rpm") \{% else %} + && RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2023.${package_version}.$(uname -m).rpm") \{% endif %} && for rpm in ${RPM_LIST[@]}; do \ curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ done \ - && dnf install -y ${CORRETO_TEMP}/*.rpm \ - {% if jre %} - && alternatives --install /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto java-{{JDK_VERSION}}-amazon-corretto /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m) 100 \ - && popd \ - {%if version_8 %} - && rm -rf /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ - {% else %} - && rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ - {% endif %} + && dnf install -y ${CORRETO_TEMP}/*.rpm \{% if jre %} + && alternatives --install /usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto java-{{CORRETTO_VERSION}}-amazon-corretto /usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto.$(uname -m) 100 \{% endif %} + && popd \{%if version_8 %} + && rm -rf /usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \{% else %} + && rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \{% endif %} && rm -rf ${CORRETO_TEMP} \ - && dnf clean all \ - {% if version_8 %} - && rm -rf /var/cache/yum \ - {% endif %} + && dnf clean all \{% if version_8 and not jre%} + && rm -rf /var/cache/yum \{% endif %} && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf ENV LANG C.UTF-8 -{%if jre %} -ENV JAVA_HOME=/usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto/jre -{% else %} -ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -{% endif %} +{% if jre %}ENV JAVA_HOME=/usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto/jre{% elif version_8 %}ENV JAVA_HOME=/usr/lib/jvm/java-{{CORRETTO_VERSION}}-amazon-corretto{% else %}ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto{% endif %} From a67a4b2f2d1be188ef44c286c1f0ead03244fd36 Mon Sep 17 00:00:00 2001 From: Jenny Shivayogi Date: Fri, 4 Aug 2023 15:58:35 -0700 Subject: [PATCH 4/5] removing debug lines and adding necessary whitespaces --- bin/apply-template.py | 1 - templates/al2-headful.Dockerfile.template | 1 + templates/al2-headless.Dockerfile.template | 1 + templates/al2023-generic.Dockerfile.template | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/apply-template.py b/bin/apply-template.py index 64f6c42..7f8766b 100644 --- a/bin/apply-template.py +++ b/bin/apply-template.py @@ -35,7 +35,6 @@ def process_template_files(major_version, version, platform): elif 'headless' in platform or 'headful' in platform: head_variant = 'headless' if 'headless' in platform else 'headful' - print("executin headless or headful",platform, major_version) if major_version=='11' or major_version=='17': os.makedirs(f"{major_version}/{head_variant}/{platform}/", exist_ok=True) with open(f"{major_version}/{head_variant}/{platform}/Dockerfile", 'w') as output: diff --git a/templates/al2-headful.Dockerfile.template b/templates/al2-headful.Dockerfile.template index 6dea33b..eb896b8 100644 --- a/templates/al2-headful.Dockerfile.template +++ b/templates/al2-headful.Dockerfile.template @@ -1,6 +1,7 @@ FROM amazonlinux:2 ARG version={{CORRETTO_VERSION}} + RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.') \ && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ diff --git a/templates/al2-headless.Dockerfile.template b/templates/al2-headless.Dockerfile.template index b8f0fad..008de20 100644 --- a/templates/al2-headless.Dockerfile.template +++ b/templates/al2-headless.Dockerfile.template @@ -1,6 +1,7 @@ FROM amazonlinux:2 ARG version={{CORRETTO_VERSION}} + RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.') \ && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ diff --git a/templates/al2023-generic.Dockerfile.template b/templates/al2023-generic.Dockerfile.template index d1d4c1a..5e23d89 100644 --- a/templates/al2023-generic.Dockerfile.template +++ b/templates/al2023-generic.Dockerfile.template @@ -3,6 +3,7 @@ FROM amazonlinux:2023 ARG version={{CORRETTO_VERSION}} # In addition to installing the Amazon corretto, we also install # libs that are needed for jdk to be functional + # The logic and code related to Fingerprint is contributed by @tianon in a Github PR's Conversation # Comment = https://github.com/docker-library/official-images/pull/7459#issuecomment-592242757 # PR = https://github.com/docker-library/official-images/pull/7459 From cb37c9f70c470d2bcf6ef51e5ced37267331c3a9 Mon Sep 17 00:00:00 2001 From: Jenny Shivayogi Date: Tue, 30 Jan 2024 11:48:04 -0800 Subject: [PATCH 5/5] adding all generated Dockerfiles from templates --- 11/headful/al2-headful/Dockerfile | 26 ++++++++++++++++++++++++ 11/headful/al2023-headful/Dockerfile | 24 ++++++++++++++++++++++ 11/headless/al2-headless/Dockerfile | 26 ++++++++++++++++++++++++ 11/headless/al2023-headless/Dockerfile | 24 ++++++++++++++++++++++ 11/jdk/al2-generic/Dockerfile | 4 ++-- 11/jdk/al2/Dockerfile | 8 +++++--- 11/jdk/al2023/Dockerfile | 7 ++++--- 17/headful/al2-headful/Dockerfile | 26 ++++++++++++++++++++++++ 17/headful/al2023-headful/Dockerfile | 24 ++++++++++++++++++++++ 17/headless/al2-headless/Dockerfile | 26 ++++++++++++++++++++++++ 17/headless/al2023-headless/Dockerfile | 24 ++++++++++++++++++++++ 17/jdk/al2-generic/Dockerfile | 4 ++-- 17/jdk/al2/Dockerfile | 4 ++-- 17/jdk/al2023/Dockerfile | 4 ++-- 21/jdk/al2-generic/Dockerfile | 4 ++-- 21/jdk/al2/Dockerfile | 28 ++++++++++++++++++++++++++ 21/jdk/al2023/Dockerfile | 4 ++-- 8/jdk/al2-generic/Dockerfile | 2 +- 8/jdk/al2/Dockerfile | 5 ++--- 8/jdk/al2023/Dockerfile | 7 +++---- 8/jre/al2/Dockerfile | 11 +++++----- 8/jre/al2023/Dockerfile | 6 +++--- 22 files changed, 263 insertions(+), 35 deletions(-) create mode 100644 11/headful/al2-headful/Dockerfile create mode 100644 11/headful/al2023-headful/Dockerfile create mode 100644 11/headless/al2-headless/Dockerfile create mode 100644 11/headless/al2023-headless/Dockerfile create mode 100644 17/headful/al2-headful/Dockerfile create mode 100644 17/headful/al2023-headful/Dockerfile create mode 100644 17/headless/al2-headless/Dockerfile create mode 100644 17/headless/al2023-headless/Dockerfile create mode 100644 21/jdk/al2/Dockerfile diff --git a/11/headful/al2-headful/Dockerfile b/11/headful/al2-headful/Dockerfile new file mode 100644 index 0000000..e585b0b --- /dev/null +++ b/11/headful/al2-headful/Dockerfile @@ -0,0 +1,26 @@ +FROM amazonlinux:2 + +ARG version=11.0.22.7.1 + +RUN set -eux \ + && export resouce_version=$(echo $version | tr '-' '.') \ + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-11-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-11-amazon-corretto-$version.amzn2.1.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + && (find /usr/lib/jvm/java-11-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto \ No newline at end of file diff --git a/11/headful/al2023-headful/Dockerfile b/11/headful/al2023-headful/Dockerfile new file mode 100644 index 0000000..56973a0 --- /dev/null +++ b/11/headful/al2023-headful/Dockerfile @@ -0,0 +1,24 @@ +FROM amazonlinux:2023 + +ARG version=11.0.22.7.1 +ARG package_version=1 + +RUN set -eux \ + && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ + && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-11-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-11-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ + done \ + && dnf install -y ${CORRETO_TEMP}/*.rpm \ + && popd \ + && rm -rf /usr/lib/jvm/java-11-amazon-corretto.$(uname -m)/lib/src.zip \ + && rm -rf ${CORRETO_TEMP} \ + && dnf clean all \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto \ No newline at end of file diff --git a/11/headless/al2-headless/Dockerfile b/11/headless/al2-headless/Dockerfile new file mode 100644 index 0000000..25d4054 --- /dev/null +++ b/11/headless/al2-headless/Dockerfile @@ -0,0 +1,26 @@ +FROM amazonlinux:2 + +ARG version=11.0.22.7.1 + +RUN set -eux \ + && export resouce_version=$(echo $version | tr '-' '.') \ + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-11-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + && (find /usr/lib/jvm/java-11-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto \ No newline at end of file diff --git a/11/headless/al2023-headless/Dockerfile b/11/headless/al2023-headless/Dockerfile new file mode 100644 index 0000000..3edfe50 --- /dev/null +++ b/11/headless/al2023-headless/Dockerfile @@ -0,0 +1,24 @@ +FROM amazonlinux:2023 + +ARG version=11.0.22.7.1 +ARG package_version=1 + +RUN set -eux \ + && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ + && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-11-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ + done \ + && dnf install -y ${CORRETO_TEMP}/*.rpm \ + && popd \ + && rm -rf /usr/lib/jvm/java-11-amazon-corretto.$(uname -m)/lib/src.zip \ + && rm -rf ${CORRETO_TEMP} \ + && dnf clean all \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto \ No newline at end of file diff --git a/11/jdk/al2-generic/Dockerfile b/11/jdk/al2-generic/Dockerfile index eca0a26..5d250cf 100644 --- a/11/jdk/al2-generic/Dockerfile +++ b/11/jdk/al2-generic/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2 -ARG version=11.0.22.7-1 +ARG version=11.0.22.7.1 # In addition to installing the Amazon corretto, we also install # fontconfig. The folks who manage the docker hub's # official image library have found that font management @@ -29,4 +29,4 @@ RUN set -eux \ && yum clean all ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto \ No newline at end of file diff --git a/11/jdk/al2/Dockerfile b/11/jdk/al2/Dockerfile index 499910a..a1d58ce 100644 --- a/11/jdk/al2/Dockerfile +++ b/11/jdk/al2/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2 -ARG version=11.0.22.7-1 +ARG version=11.0.22.7.1 RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.') \ @@ -12,7 +12,9 @@ RUN set -eux \ && for rpm in ${RPM_LIST[@]}; do \ curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ - && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + && if [[ ${rpm} != *jmods* ]]; then \ + yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + fi; \ done \ && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ && popd \ @@ -23,4 +25,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto \ No newline at end of file diff --git a/11/jdk/al2023/Dockerfile b/11/jdk/al2023/Dockerfile index c6159b6..3541932 100644 --- a/11/jdk/al2023/Dockerfile +++ b/11/jdk/al2023/Dockerfile @@ -1,13 +1,14 @@ FROM amazonlinux:2023 -ARG version=11.0.22.7-1 +ARG version=11.0.22.7.1 +ARG package_version=1 RUN set -eux \ && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ && CORRETO_TEMP=$(mktemp -d) \ && pushd ${CORRETO_TEMP} \ - && RPM_LIST=("java-11-amazon-corretto-headless-$version.amzn2023.$(uname -m).rpm" "java-11-amazon-corretto-$version.amzn2023.$(uname -m).rpm" "java-11-amazon-corretto-devel-$version.amzn2023.$(uname -m).rpm" "java-11-amazon-corretto-jmods-$version.amzn2023.$(uname -m).rpm") \ + && RPM_LIST=("java-11-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-11-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-11-amazon-corretto-devel-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-11-amazon-corretto-jmods-$version.amzn2023.${package_version}.$(uname -m).rpm") \ && for rpm in ${RPM_LIST[@]}; do \ curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ @@ -20,4 +21,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto \ No newline at end of file diff --git a/17/headful/al2-headful/Dockerfile b/17/headful/al2-headful/Dockerfile new file mode 100644 index 0000000..f5cbcdb --- /dev/null +++ b/17/headful/al2-headful/Dockerfile @@ -0,0 +1,26 @@ +FROM amazonlinux:2 + +ARG version=17.0.10.7.1 + +RUN set -eux \ + && export resouce_version=$(echo $version | tr '-' '.') \ + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-17-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-17-amazon-corretto-$version.amzn2.1.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + && (find /usr/lib/jvm/java-17-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto \ No newline at end of file diff --git a/17/headful/al2023-headful/Dockerfile b/17/headful/al2023-headful/Dockerfile new file mode 100644 index 0000000..b824f46 --- /dev/null +++ b/17/headful/al2023-headful/Dockerfile @@ -0,0 +1,24 @@ +FROM amazonlinux:2023 + +ARG version=17.0.10.7.1 +ARG package_version=1 + +RUN set -eux \ + && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ + && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-17-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-17-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ + done \ + && dnf install -y ${CORRETO_TEMP}/*.rpm \ + && popd \ + && rm -rf /usr/lib/jvm/java-17-amazon-corretto.$(uname -m)/lib/src.zip \ + && rm -rf ${CORRETO_TEMP} \ + && dnf clean all \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto \ No newline at end of file diff --git a/17/headless/al2-headless/Dockerfile b/17/headless/al2-headless/Dockerfile new file mode 100644 index 0000000..c1b43b0 --- /dev/null +++ b/17/headless/al2-headless/Dockerfile @@ -0,0 +1,26 @@ +FROM amazonlinux:2 + +ARG version=17.0.10.7.1 + +RUN set -eux \ + && export resouce_version=$(echo $version | tr '-' '.') \ + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-17-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + && (find /usr/lib/jvm/java-17-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto \ No newline at end of file diff --git a/17/headless/al2023-headless/Dockerfile b/17/headless/al2023-headless/Dockerfile new file mode 100644 index 0000000..ed07d1c --- /dev/null +++ b/17/headless/al2023-headless/Dockerfile @@ -0,0 +1,24 @@ +FROM amazonlinux:2023 + +ARG version=17.0.10.7.1 +ARG package_version=1 + +RUN set -eux \ + && rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ + && echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-17-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ + done \ + && dnf install -y ${CORRETO_TEMP}/*.rpm \ + && popd \ + && rm -rf /usr/lib/jvm/java-17-amazon-corretto.$(uname -m)/lib/src.zip \ + && rm -rf ${CORRETO_TEMP} \ + && dnf clean all \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto \ No newline at end of file diff --git a/17/jdk/al2-generic/Dockerfile b/17/jdk/al2-generic/Dockerfile index a3297aa..7074728 100644 --- a/17/jdk/al2-generic/Dockerfile +++ b/17/jdk/al2-generic/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2 -ARG version=17.0.10.7-1 +ARG version=17.0.10.7.1 # In addition to installing the Amazon corretto, we also install # fontconfig. The folks who manage the docker hub's # official image library have found that font management @@ -29,4 +29,4 @@ RUN set -eux \ && yum clean all ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto \ No newline at end of file diff --git a/17/jdk/al2/Dockerfile b/17/jdk/al2/Dockerfile index 9185cd2..c5c525e 100644 --- a/17/jdk/al2/Dockerfile +++ b/17/jdk/al2/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2 -ARG version=17.0.10.7-1 +ARG version=17.0.10.7.1 RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.') \ @@ -15,7 +15,7 @@ RUN set -eux \ && if [[ ${rpm} != *jmods* ]]; then \ yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ fi; \ - done \ + done \ && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ && popd \ && (find /usr/lib/jvm/java-17-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ diff --git a/17/jdk/al2023/Dockerfile b/17/jdk/al2023/Dockerfile index a125cf1..a0d4067 100644 --- a/17/jdk/al2023/Dockerfile +++ b/17/jdk/al2023/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2023 -ARG version=17.0.10.7-1 +ARG version=17.0.10.7.1 ARG package_version=1 RUN set -eux \ @@ -21,4 +21,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto \ No newline at end of file diff --git a/21/jdk/al2-generic/Dockerfile b/21/jdk/al2-generic/Dockerfile index 20556f1..9cb7d45 100644 --- a/21/jdk/al2-generic/Dockerfile +++ b/21/jdk/al2-generic/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2 -ARG version=21.0.2.13-1 +ARG version=21.0.2.13.1 # In addition to installing the Amazon corretto, we also install # fontconfig. The folks who manage the docker hub's # official image library have found that font management @@ -29,4 +29,4 @@ RUN set -eux \ && yum clean all ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto \ No newline at end of file diff --git a/21/jdk/al2/Dockerfile b/21/jdk/al2/Dockerfile new file mode 100644 index 0000000..13ce6da --- /dev/null +++ b/21/jdk/al2/Dockerfile @@ -0,0 +1,28 @@ +FROM amazonlinux:2 + +ARG version=21.0.2.13.1 + +RUN set -eux \ + && export resouce_version=$(echo $version | tr '-' '.') \ + && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ + && echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ + && CORRETO_TEMP=$(mktemp -d) \ + && pushd ${CORRETO_TEMP} \ + && RPM_LIST=("java-21-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-21-amazon-corretto-$version.amzn2.1.$(uname -m).rpm" "java-21-amazon-corretto-devel-$version.amzn2.1.$(uname -m).rpm" "java-21-amazon-corretto-jmods-$version.amzn2.1.$(uname -m).rpm") \ + && for rpm in ${RPM_LIST[@]}; do \ + curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ + && if [[ ${rpm} != *jmods* ]]; then \ + yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ + fi; \ + done \ + && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ + && popd \ + && (find /usr/lib/jvm/java-21-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ + && rm -rf ${CORRETO_TEMP} \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf + +ENV LANG C.UTF-8 +ENV JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto \ No newline at end of file diff --git a/21/jdk/al2023/Dockerfile b/21/jdk/al2023/Dockerfile index 12fe6a1..ceb141a 100644 --- a/21/jdk/al2023/Dockerfile +++ b/21/jdk/al2023/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2023 -ARG version=21.0.2.13-1 +ARG version=21.0.2.13.1 ARG package_version=1 RUN set -eux \ @@ -21,4 +21,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto \ No newline at end of file diff --git a/8/jdk/al2-generic/Dockerfile b/8/jdk/al2-generic/Dockerfile index 44e8660..1da4de2 100644 --- a/8/jdk/al2-generic/Dockerfile +++ b/8/jdk/al2-generic/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2 -ARG version=1.8.0_402.b08-1 +ARG version=1.8.0 # In addition to installing the Amazon corretto, we also install # fontconfig. The folks who manage the docker hub's # official image library have found that font management diff --git a/8/jdk/al2/Dockerfile b/8/jdk/al2/Dockerfile index e5a17d4..db70b1b 100644 --- a/8/jdk/al2/Dockerfile +++ b/8/jdk/al2/Dockerfile @@ -1,7 +1,6 @@ FROM amazonlinux:2 -ARG version=1.8.0_402.b08-1 - +ARG version=1.8.0 RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ @@ -24,4 +23,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto \ No newline at end of file diff --git a/8/jdk/al2023/Dockerfile b/8/jdk/al2023/Dockerfile index ca5f453..2dbbed6 100644 --- a/8/jdk/al2023/Dockerfile +++ b/8/jdk/al2023/Dockerfile @@ -1,7 +1,6 @@ FROM amazonlinux:2023 -ARG version=1.8.0_402.b08-1 - +ARG version=1.8.0 RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ @@ -11,7 +10,7 @@ RUN set -eux \ && pushd ${CORRETO_TEMP} \ && RPM_LIST=("java-1.8.0-amazon-corretto-$version.amzn2023.$(uname -m).rpm" "java-1.8.0-amazon-corretto-devel-$version.amzn2023.$(uname -m).rpm") \ && for rpm in ${RPM_LIST[@]}; do \ - curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ done \ && dnf install -y ${CORRETO_TEMP}/*.rpm \ @@ -23,4 +22,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto +ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto \ No newline at end of file diff --git a/8/jre/al2/Dockerfile b/8/jre/al2/Dockerfile index 3af7644..c5f6cc9 100644 --- a/8/jre/al2/Dockerfile +++ b/8/jre/al2/Dockerfile @@ -1,7 +1,6 @@ FROM amazonlinux:2 -ARG version=1.8.0_402.b08-1 - +ARG version=1.8.0 RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ @@ -13,16 +12,16 @@ RUN set -eux \ && for rpm in ${RPM_LIST[@]}; do \ curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ && echo $(rpm -K "${CORRETO_TEMP}/${rpm}") \ - && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1; \ + && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ done \ - && yum install -y $(yum deplist ${CORRETO_TEMP}/*.rpm |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ) \ + && yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ); \ && rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ && popd \ - && rm -rf /usr/lib/jvm/java-1.8.0-amazon-corretto.$(uname -m)/lib/src.zip \ + && (find /usr/lib/jvm/java-1.8.0-amazon-corretto.$(uname -m) -name "*src.zip" -delete || true) \ && rm -rf ${CORRETO_TEMP} \ && yum clean all \ && rm -rf /var/cache/yum \ && sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto/jre +ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto/jre \ No newline at end of file diff --git a/8/jre/al2023/Dockerfile b/8/jre/al2023/Dockerfile index 5efc4a3..1d1fda0 100644 --- a/8/jre/al2023/Dockerfile +++ b/8/jre/al2023/Dockerfile @@ -1,6 +1,6 @@ FROM amazonlinux:2023 -ARG version=1.8.0_402.b08-1 +ARG version=1.8.0 RUN set -eux \ && export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ @@ -10,7 +10,7 @@ RUN set -eux \ && pushd ${CORRETO_TEMP} \ && RPM_LIST=("java-1.8.0-amazon-corretto-$version.amzn2023.$(uname -m).rpm") \ && for rpm in ${RPM_LIST[@]}; do \ - curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ + curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ && rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ done \ && dnf install -y ${CORRETO_TEMP}/*.rpm \ @@ -22,4 +22,4 @@ RUN set -eux \ && sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf ENV LANG C.UTF-8 -ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto/jre +ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto/jre \ No newline at end of file