From 0da258dcde0408ca9a2ff5231dd01ebb227a234f Mon Sep 17 00:00:00 2001 From: George Adams Date: Tue, 13 Aug 2024 09:39:32 +0100 Subject: [PATCH] apk: fix install versions --- 11/jdk/alpine/Dockerfile | 13 ++--- 11/jre/alpine/Dockerfile | 13 ++--- 17/jdk/alpine/Dockerfile | 15 +++--- 17/jre/alpine/Dockerfile | 16 +++--- 21/jdk/alpine/Dockerfile | 15 +++--- 21/jre/alpine/Dockerfile | 16 +++--- 22/jdk/alpine/Dockerfile | 15 +++--- 22/jre/alpine/Dockerfile | 16 +++--- 8/jdk/alpine/Dockerfile | 13 ++--- 8/jre/alpine/Dockerfile | 13 ++--- config/packages.yml | 57 +++++++++++++++++++++ config/{hotspot.yml => temurin.yml} | 0 docker_templates/alpine-linux.Dockerfile.j2 | 28 +++++----- generate_dockerfiles.py | 7 ++- 14 files changed, 157 insertions(+), 80 deletions(-) create mode 100644 config/packages.yml rename config/{hotspot.yml => temurin.yml} (100%) diff --git a/11/jdk/alpine/Dockerfile b/11/jdk/alpine/Dockerfile index 6b2dc1b78..4692a76fc 100644 --- a/11/jdk/alpine/Dockerfile +++ b/11/jdk/alpine/Dockerfile @@ -30,18 +30,19 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ - tzdata \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/11/jre/alpine/Dockerfile b/11/jre/alpine/Dockerfile index f5254041e..b30012ddb 100644 --- a/11/jre/alpine/Dockerfile +++ b/11/jre/alpine/Dockerfile @@ -30,18 +30,19 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ - tzdata \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/17/jdk/alpine/Dockerfile b/17/jdk/alpine/Dockerfile index b9a1fad7c..867ea64a2 100644 --- a/17/jdk/alpine/Dockerfile +++ b/17/jdk/alpine/Dockerfile @@ -30,21 +30,22 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory - binutils \ - tzdata \ + binutils=2.37-r0 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/17/jre/alpine/Dockerfile b/17/jre/alpine/Dockerfile index 32554041b..938c80fc2 100644 --- a/17/jre/alpine/Dockerfile +++ b/17/jre/alpine/Dockerfile @@ -30,18 +30,22 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ - tzdata \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ + # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 + # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory + binutils=2.37-r0 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/21/jdk/alpine/Dockerfile b/21/jdk/alpine/Dockerfile index 01bae8796..8dd4b0e71 100644 --- a/21/jdk/alpine/Dockerfile +++ b/21/jdk/alpine/Dockerfile @@ -30,21 +30,22 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory - binutils \ - tzdata \ + binutils=2.37-r0 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/21/jre/alpine/Dockerfile b/21/jre/alpine/Dockerfile index 52799021d..b9b91f162 100644 --- a/21/jre/alpine/Dockerfile +++ b/21/jre/alpine/Dockerfile @@ -30,18 +30,22 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ - tzdata \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ + # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 + # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory + binutils=2.37-r0 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/22/jdk/alpine/Dockerfile b/22/jdk/alpine/Dockerfile index 5b20df4d8..70d8ade5a 100644 --- a/22/jdk/alpine/Dockerfile +++ b/22/jdk/alpine/Dockerfile @@ -30,21 +30,22 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory - binutils \ - tzdata \ + binutils=2.37-r0 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/22/jre/alpine/Dockerfile b/22/jre/alpine/Dockerfile index f27a32121..5376d3e11 100644 --- a/22/jre/alpine/Dockerfile +++ b/22/jre/alpine/Dockerfile @@ -30,18 +30,22 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ - tzdata \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ + # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 + # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory + binutils=2.37-r0 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/8/jdk/alpine/Dockerfile b/8/jdk/alpine/Dockerfile index 0c5489763..6fc5a8f57 100644 --- a/8/jdk/alpine/Dockerfile +++ b/8/jdk/alpine/Dockerfile @@ -30,18 +30,19 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ - tzdata \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/8/jre/alpine/Dockerfile b/8/jre/alpine/Dockerfile index c25b62992..faff1f194 100644 --- a/8/jre/alpine/Dockerfile +++ b/8/jre/alpine/Dockerfile @@ -30,18 +30,19 @@ RUN set -eux; \ # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ + fontconfig=2.15.0-r1 ttf-dejavu=2.37-r5 \ # utilities for keeping Alpine and OpenJDK CA certificates in sync # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ + ca-certificates=20240705-r0 p11-kit-trust=0.25.3-r0 \ # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ - tzdata \ + musl-locales=0.1.0-r1 musl-locales-lang=0.1.0-r1 \ + tzdata=2024a-r1 \ # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can # only import one at a time. - coreutils \ + coreutils=9.5-r1 \ # Needed to extract CN and generate aliases for certificates - openssl \ + openssl=3.3.1-r3 \ + \ ; \ rm -rf /var/cache/apk/* diff --git a/config/packages.yml b/config/packages.yml new file mode 100644 index 000000000..92ee89666 --- /dev/null +++ b/config/packages.yml @@ -0,0 +1,57 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +apk: + fonts: + packages: + fontconfig: 2.15.0-r1 + ttf-dejavu: 2.37-r5 + description: | + java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory + java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager + https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 + cacerts: + packages: + ca-certificates: 20240705-r0 + p11-kit-trust: 0.25.3-r0 + description: | + utilities for keeping Alpine and OpenJDK CA certificates in sync + https://github.com/adoptium/containers/issues/293 + locales: + packages: + musl-locales: 0.1.0-r1 + musl-locales-lang: 0.1.0-r1 + description: | + locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 + binutils: + packages: + binutils: 2.37-r0 + version: '>=17' + description: | + jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 + Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory + tzdata: + packages: + tzdata: 2024a-r1 + coreutils: + packages: + coreutils: 9.5-r1 + description: | + Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can + only import one at a time. + openssl: + packages: + openssl: 3.3.1-r3 + description: | + Needed to extract CN and generate aliases for certificates diff --git a/config/hotspot.yml b/config/temurin.yml similarity index 100% rename from config/hotspot.yml rename to config/temurin.yml diff --git a/docker_templates/alpine-linux.Dockerfile.j2 b/docker_templates/alpine-linux.Dockerfile.j2 index 41d379279..9eb354425 100644 --- a/docker_templates/alpine-linux.Dockerfile.j2 +++ b/docker_templates/alpine-linux.Dockerfile.j2 @@ -4,26 +4,22 @@ FROM {{ base_image }} {% include 'partials/nix-env.j2' %} +{% if packages['apk'] -%} RUN set -eux; \ apk add --no-cache \ - # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory - # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager - # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig ttf-dejavu \ - # utilities for keeping Alpine and OpenJDK CA certificates in sync - # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit-trust \ - # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - musl-locales musl-locales-lang \ -{% include 'partials/binutils.j2' -%} - tzdata \ - # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can - # only import one at a time. - coreutils \ - # Needed to extract CN and generate aliases for certificates - openssl \ + {% for package_group, details in packages['apk'].items() -%} + {% if details['version'] is not defined or version|int >= details['version']|int -%} + {% if details['description'] -%} + # {{ details['description'].strip() | replace('\n', '\n # ') }} + {% endif -%} + {%- for package, version in details['packages'].items() -%} + {{ package }}={{ version }}{% if not loop.last %} {% else %} \{% endif %} + {%- endfor %} + {% endif -%} + {% endfor -%}\ ; \ rm -rf /var/cache/apk/* +{%- endif %} ENV JAVA_VERSION {{ java_version }} diff --git a/generate_dockerfiles.py b/generate_dockerfiles.py index 280643bed..ea5e2aacc 100644 --- a/generate_dockerfiles.py +++ b/generate_dockerfiles.py @@ -65,7 +65,7 @@ def archHelper(arch, os_name): # Load the YAML configuration -with open("config/hotspot.yml", "r") as file: +with open("config/temurin.yml", "r") as file: config = yaml.safe_load(file) # Iterate through OS families and then configurations @@ -153,6 +153,10 @@ def archHelper(arch, os_name): # Sort arch_data by key arch_data = dict(sorted(arch_data.items())) + # Load the YAML packages config file + with open("config/packages.yml", "r") as file: + packages = yaml.safe_load(file) + # Generate Dockerfile for each architecture rendered_dockerfile = template.render( base_image=base_image, @@ -162,6 +166,7 @@ def archHelper(arch, os_name): arch_data=arch_data, os_family=os_family, os=os_name, + packages=packages, ) print("Writing Dockerfile to", output_directory)