diff --git a/11/jdk/alpine/Dockerfile b/11/jdk/alpine/Dockerfile index 27e8199c7..033397b08 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 3b8aa07cb..436cdc016 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 cd77a10a1..ec9f3ece7 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.42-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 f0479b51c..589d6d678 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.42-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 c62668a9d..7632e8544 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.42-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 ea62602d2..470ec4110 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.42-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 2086669c5..fbbd970cb 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.42-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 600d752ef..b257473a6 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.42-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 649eba723..96ffd31f8 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 e0daf20ee..147d2863e 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..5a124c01e --- /dev/null +++ b/config/packages.yml @@ -0,0 +1,58 @@ +# +# 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.42-r0 + version: 17 + version_operator: '>=' + 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 9344dd20f..0343033b5 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 details['version']|compare_versions(details['version_operator'], version) -%} + {% 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 %} {% include 'partials/java-version.j2' %} diff --git a/generate_dockerfiles.py b/generate_dockerfiles.py index 4576050dd..12a3151a8 100644 --- a/generate_dockerfiles.py +++ b/generate_dockerfiles.py @@ -55,6 +55,30 @@ def archHelper(arch, os_name): return arch +def compare_versions(version_str, comparator, reference_version): + v1 = int(reference_version) + v2 = int(version_str) + + print(f"Comparing {v1} {comparator} {v2}") + + if comparator == ">": + return v1 > v2 + elif comparator == ">=": + return v1 >= v2 + elif comparator == "<": + return v1 < v2 + elif comparator == "<=": + return v1 <= v2 + elif comparator == "==": + return v1 == v2 + elif comparator == "!=": + return v1 != v2 + else: + raise ValueError(f"Unknown comparator: {comparator}") + + +env.filters["compare_versions"] = compare_versions + # Remove old Dockerfiles if --force is set if args.force: # Remove all top level dirs that are numbers @@ -65,7 +89,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 +177,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 +190,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)