├── 26 ├── windows │ ├── nanoserver-ltsc2022 │ │ └── Dockerfile │ ├── nanoserver-ltsc2025 │ │ └── Dockerfile │ ├── windowsservercore-ltsc2022 │ │ └── Dockerfile │ └── windowsservercore-ltsc2025 │ │ └── Dockerfile ├── oraclelinux8 │ └── Dockerfile ├── oraclelinux9 │ └── Dockerfile ├── slim-trixie │ └── Dockerfile ├── slim-bookworm │ └── Dockerfile ├── trixie │ └── Dockerfile └── bookworm │ └── Dockerfile ├── 27 ├── windows │ ├── nanoserver-ltsc2022 │ │ └── Dockerfile │ ├── nanoserver-ltsc2025 │ │ └── Dockerfile │ ├── windowsservercore-ltsc2022 │ │ └── Dockerfile │ └── windowsservercore-ltsc2025 │ │ └── Dockerfile ├── oraclelinux8 │ └── Dockerfile ├── oraclelinux9 │ └── Dockerfile ├── slim-trixie │ └── Dockerfile ├── slim-bookworm │ └── Dockerfile ├── trixie │ └── Dockerfile └── bookworm │ └── Dockerfile ├── .gitignore ├── .gitattributes ├── update.sh ├── .github └── workflows │ ├── verify-templating.yml │ └── ci.yml ├── generate-stackbrew-library.sh ├── LICENSE ├── apply-templates.sh ├── versions.json ├── README.md ├── generate-stackbrew-library.jq ├── Dockerfile-windows.template ├── versions.sh └── Dockerfile-linux.template /.gitignore: -------------------------------------------------------------------------------- 1 | .jq-template.awk 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /*/**/Dockerfile linguist-generated 2 | /Dockerfile*.template linguist-language=Dockerfile 3 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | ./versions.sh "$@" 7 | ./apply-templates.sh "$@" 8 | -------------------------------------------------------------------------------- /.github/workflows/verify-templating.yml: -------------------------------------------------------------------------------- 1 | name: Verify Templating 2 | 3 | on: 4 | pull_request: 5 | push: 6 | workflow_dispatch: 7 | 8 | defaults: 9 | run: 10 | shell: 'bash -Eeuo pipefail -x {0}' 11 | 12 | jobs: 13 | apply-templates: 14 | name: Check For Uncomitted Changes 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | - run: ./apply-templates.sh 19 | - run: git diff --exit-code 20 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | self="$(basename "$BASH_SOURCE")" 5 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 6 | 7 | # get the most recent commit which modified any files related to a build context 8 | commit="$(git log -1 --format='format:%H' HEAD -- '[^.]*/**')" 9 | 10 | # TODO fetch parent arches so we can exclude things from "versions.json" that our base image doesn't support (if any) 11 | 12 | selfCommit="$(git log -1 --format='format:%H' HEAD -- "$self")" 13 | cat <<-EOH 14 | # this file is generated via https://github.com/docker-library/openjdk/blob/$selfCommit/$self 15 | 16 | Maintainers: Tianon Gravi (@tianon), 17 | Joseph Ferguson (@yosifkit) 18 | GitRepo: https://github.com/docker-library/openjdk.git 19 | GitCommit: $commit 20 | EOH 21 | 22 | exec jq \ 23 | --raw-output \ 24 | --from-file generate-stackbrew-library.jq \ 25 | versions.json \ 26 | --args -- "$@" 27 | -------------------------------------------------------------------------------- /26/windows/nanoserver-ltsc2022/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 8 | 9 | SHELL ["cmd", "/s", "/c"] 10 | 11 | ENV JAVA_HOME C:\\openjdk-26 12 | # "ERROR: Access to the registry path is denied." 13 | USER ContainerAdministrator 14 | RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \ 15 | && setx /M PATH %JAVA_HOME%\bin;%PATH% \ 16 | && echo Complete. 17 | USER ContainerUser 18 | 19 | # https://jdk.java.net/ 20 | # > 21 | # > Java Development Kit builds, from Oracle 22 | # > 23 | ENV JAVA_VERSION 26-ea+28 24 | 25 | COPY --from=openjdk:26-ea-28-windowsservercore-ltsc2022 $JAVA_HOME $JAVA_HOME 26 | 27 | RUN echo Verifying install ... \ 28 | && echo javac --version && javac --version \ 29 | && echo java --version && java --version \ 30 | && echo Complete. 31 | 32 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 33 | CMD ["jshell"] 34 | -------------------------------------------------------------------------------- /26/windows/nanoserver-ltsc2025/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/nanoserver:ltsc2025 8 | 9 | SHELL ["cmd", "/s", "/c"] 10 | 11 | ENV JAVA_HOME C:\\openjdk-26 12 | # "ERROR: Access to the registry path is denied." 13 | USER ContainerAdministrator 14 | RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \ 15 | && setx /M PATH %JAVA_HOME%\bin;%PATH% \ 16 | && echo Complete. 17 | USER ContainerUser 18 | 19 | # https://jdk.java.net/ 20 | # > 21 | # > Java Development Kit builds, from Oracle 22 | # > 23 | ENV JAVA_VERSION 26-ea+28 24 | 25 | COPY --from=openjdk:26-ea-28-windowsservercore-ltsc2025 $JAVA_HOME $JAVA_HOME 26 | 27 | RUN echo Verifying install ... \ 28 | && echo javac --version && javac --version \ 29 | && echo java --version && java --version \ 30 | && echo Complete. 31 | 32 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 33 | CMD ["jshell"] 34 | -------------------------------------------------------------------------------- /27/windows/nanoserver-ltsc2022/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 8 | 9 | SHELL ["cmd", "/s", "/c"] 10 | 11 | ENV JAVA_HOME C:\\openjdk-27 12 | # "ERROR: Access to the registry path is denied." 13 | USER ContainerAdministrator 14 | RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \ 15 | && setx /M PATH %JAVA_HOME%\bin;%PATH% \ 16 | && echo Complete. 17 | USER ContainerUser 18 | 19 | # https://jdk.java.net/ 20 | # > 21 | # > Java Development Kit builds, from Oracle 22 | # > 23 | ENV JAVA_VERSION 27-ea+2 24 | 25 | COPY --from=openjdk:27-ea-2-windowsservercore-ltsc2022 $JAVA_HOME $JAVA_HOME 26 | 27 | RUN echo Verifying install ... \ 28 | && echo javac --version && javac --version \ 29 | && echo java --version && java --version \ 30 | && echo Complete. 31 | 32 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 33 | CMD ["jshell"] 34 | -------------------------------------------------------------------------------- /27/windows/nanoserver-ltsc2025/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/nanoserver:ltsc2025 8 | 9 | SHELL ["cmd", "/s", "/c"] 10 | 11 | ENV JAVA_HOME C:\\openjdk-27 12 | # "ERROR: Access to the registry path is denied." 13 | USER ContainerAdministrator 14 | RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \ 15 | && setx /M PATH %JAVA_HOME%\bin;%PATH% \ 16 | && echo Complete. 17 | USER ContainerUser 18 | 19 | # https://jdk.java.net/ 20 | # > 21 | # > Java Development Kit builds, from Oracle 22 | # > 23 | ENV JAVA_VERSION 27-ea+2 24 | 25 | COPY --from=openjdk:27-ea-2-windowsservercore-ltsc2025 $JAVA_HOME $JAVA_HOME 26 | 27 | RUN echo Verifying install ... \ 28 | && echo javac --version && javac --version \ 29 | && echo java --version && java --version \ 30 | && echo Complete. 31 | 32 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 33 | CMD ["jshell"] 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Docker, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | - cron: 0 0 * * 0 8 | 9 | defaults: 10 | run: 11 | shell: 'bash -Eeuo pipefail -x {0}' 12 | 13 | jobs: 14 | 15 | generate-jobs: 16 | name: Generate Jobs 17 | runs-on: ubuntu-latest 18 | outputs: 19 | strategy: ${{ steps.generate-jobs.outputs.strategy }} 20 | steps: 21 | - uses: actions/checkout@v4 22 | - uses: docker-library/bashbrew@HEAD 23 | - id: generate-jobs 24 | name: Generate Jobs 25 | run: | 26 | strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" 27 | echo "strategy=$strategy" >> "$GITHUB_OUTPUT" 28 | jq . <<<"$strategy" # sanity check / debugging aid 29 | 30 | test: 31 | needs: generate-jobs 32 | strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} 33 | name: ${{ matrix.name }} 34 | runs-on: ${{ matrix.os }} 35 | steps: 36 | - uses: actions/checkout@v4 37 | - name: Prepare Environment 38 | run: ${{ matrix.runs.prepare }} 39 | - name: Pull Dependencies 40 | run: ${{ matrix.runs.pull }} 41 | - name: Build ${{ matrix.name }} 42 | run: ${{ matrix.runs.build }} 43 | - name: History ${{ matrix.name }} 44 | run: ${{ matrix.runs.history }} 45 | - name: Test ${{ matrix.name }} 46 | run: ${{ matrix.runs.test }} 47 | - name: '"docker images"' 48 | run: ${{ matrix.runs.images }} 49 | -------------------------------------------------------------------------------- /apply-templates.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | [ -f versions.json ] # run "versions.sh" first 5 | 6 | jqt='.jq-template.awk' 7 | if [ -n "${BASHBREW_SCRIPTS:-}" ]; then 8 | jqt="$BASHBREW_SCRIPTS/jq-template.awk" 9 | elif [ "$BASH_SOURCE" -nt "$jqt" ]; then 10 | # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk 11 | wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk' 12 | fi 13 | 14 | if [ "$#" -eq 0 ]; then 15 | versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" 16 | eval "set -- $versions" 17 | fi 18 | 19 | generated_warning() { 20 | cat <<-EOH 21 | # 22 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 23 | # 24 | # PLEASE DO NOT EDIT IT DIRECTLY. 25 | # 26 | 27 | EOH 28 | } 29 | 30 | for version; do 31 | export version 32 | 33 | rm -rf "$version/" 34 | 35 | variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" 36 | eval "variants=( $variants )" 37 | 38 | for variant in "${variants[@]}"; do 39 | export variant 40 | 41 | dir="$version/$variant" 42 | mkdir -p "$dir" 43 | 44 | case "$variant" in 45 | windows/*) 46 | template='Dockerfile-windows.template' 47 | ;; 48 | 49 | *) 50 | template='Dockerfile-linux.template' 51 | ;; 52 | esac 53 | 54 | echo "processing $dir ..." 55 | 56 | { 57 | generated_warning 58 | gawk -f "$jqt" "$template" 59 | } > "$dir/Dockerfile" 60 | done 61 | done 62 | -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "26": { 3 | "version": "26-ea+28", 4 | "arches": { 5 | "amd64": { 6 | "url": "https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-x64_bin.tar.gz", 7 | "sha256": "a18910b0bdceb12a4f78147a1feebee50cc621ad8114c07a1ab071e58c17b09d" 8 | }, 9 | "arm64v8": { 10 | "url": "https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-aarch64_bin.tar.gz", 11 | "sha256": "d330a706e3fc611f4b39f6768f104e47d0a755ffabda31e3299dbc2e791f4f18" 12 | }, 13 | "windows-amd64": { 14 | "url": "https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_windows-x64_bin.zip", 15 | "sha256": "1043a56a8e09613f76543d6e9290ff5c53e9cc2bcf0053550a36ad993843bf2c" 16 | } 17 | }, 18 | "variants": [ 19 | "oraclelinux9", 20 | "oraclelinux8", 21 | "trixie", 22 | "slim-trixie", 23 | "bookworm", 24 | "slim-bookworm", 25 | "windows/windowsservercore-ltsc2025", 26 | "windows/windowsservercore-ltsc2022", 27 | "windows/nanoserver-ltsc2025", 28 | "windows/nanoserver-ltsc2022" 29 | ] 30 | }, 31 | "27": { 32 | "version": "27-ea+2", 33 | "arches": { 34 | "amd64": { 35 | "url": "https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-x64_bin.tar.gz", 36 | "sha256": "95b0225ac04e0034ffe1626daf09cf436a54ac3b74fef67ccd00534beb7715f5" 37 | }, 38 | "arm64v8": { 39 | "url": "https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-aarch64_bin.tar.gz", 40 | "sha256": "111a65a5acf09c18b471be75d77130d10b4c425d192ae243e3940da32e5d6dca" 41 | }, 42 | "windows-amd64": { 43 | "url": "https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_windows-x64_bin.zip", 44 | "sha256": "486eb3681d48770501631da706141ae22a0bc408cb4899e2370656479dd8ebfd" 45 | } 46 | }, 47 | "variants": [ 48 | "oraclelinux9", 49 | "oraclelinux8", 50 | "trixie", 51 | "slim-trixie", 52 | "bookworm", 53 | "slim-bookworm", 54 | "windows/windowsservercore-ltsc2025", 55 | "windows/windowsservercore-ltsc2022", 56 | "windows/nanoserver-ltsc2025", 57 | "windows/nanoserver-ltsc2022" 58 | ] 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | 3 | This image is officially deprecated and all users are recommended to find and use suitable replacements ASAP. Some examples of other Official Image alternatives (listed in alphabetical order with no intentional or implied preference): 4 | 5 | - [`amazoncorretto`](https://hub.docker.com/_/amazoncorretto) 6 | - [`eclipse-temurin`](https://hub.docker.com/_/eclipse-temurin) 7 | - [`ibm-semeru-runtimes`](https://hub.docker.com/_/ibm-semeru-runtimes) 8 | - [`ibmjava`](https://hub.docker.com/_/ibmjava) 9 | - [`sapmachine`](https://hub.docker.com/_/sapmachine) 10 | 11 | See [docker-library/openjdk#505](https://github.com/docker-library/openjdk/issues/505) for more information. 12 | 13 | The only tags which will continue to receive updates beyond July 2022 will be Early Access builds (which are sourced from [jdk.java.net](https://jdk.java.net/)), as those are not published/supported by any of the above projects. 14 | 15 | # https://github.com/docker-library/openjdk 16 | 17 | ## Maintained by: [the Docker Community](https://github.com/docker-library/openjdk) 18 | 19 | This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [`openjdk`](https://hub.docker.com/_/openjdk/) (not to be confused with any official `openjdk` image provided by `openjdk` upstream). See [the Docker Hub page](https://hub.docker.com/_/openjdk/) for the full readme on how to use this Docker image and for information regarding contributing and issues. 20 | 21 | The [full image description on Docker Hub](https://hub.docker.com/_/openjdk/) is generated/maintained over in [the docker-library/docs repository](https://github.com/docker-library/docs), specifically in [the `openjdk` directory](https://github.com/docker-library/docs/tree/master/openjdk). 22 | 23 | ## See a change merged here that doesn't show up on Docker Hub yet? 24 | 25 | For more information about the full official images change lifecycle, see [the "An image's source changed in Git, now what?" FAQ entry](https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what). 26 | 27 | For outstanding `openjdk` image PRs, check [PRs with the "library/openjdk" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Fopenjdk). For the current "source of truth" for [`openjdk`](https://hub.docker.com/_/openjdk/), see [the `library/openjdk` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/openjdk). 28 | 29 | 30 | -------------------------------------------------------------------------------- /27/oraclelinux8/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM oraclelinux:8-slim 8 | 9 | RUN set -eux; \ 10 | microdnf install \ 11 | gzip \ 12 | tar \ 13 | \ 14 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 15 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 16 | binutils \ 17 | # java.lang.UnsatisfiedLinkError: /usr/java/openjdk-12/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 18 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 19 | freetype fontconfig \ 20 | ; \ 21 | microdnf clean all 22 | 23 | ENV JAVA_HOME /usr/java/openjdk-27 24 | ENV PATH $JAVA_HOME/bin:$PATH 25 | 26 | # Default to UTF-8 file.encoding 27 | ENV LANG C.UTF-8 28 | 29 | # https://jdk.java.net/ 30 | # > 31 | # > Java Development Kit builds, from Oracle 32 | # > 33 | ENV JAVA_VERSION 27-ea+2 34 | 35 | RUN set -eux; \ 36 | \ 37 | arch="$(rpm --query --queryformat='%{ARCH}' rpm)"; \ 38 | case "$arch" in \ 39 | 'x86_64') \ 40 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-x64_bin.tar.gz'; \ 41 | downloadSha256='95b0225ac04e0034ffe1626daf09cf436a54ac3b74fef67ccd00534beb7715f5'; \ 42 | ;; \ 43 | 'aarch64') \ 44 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-aarch64_bin.tar.gz'; \ 45 | downloadSha256='111a65a5acf09c18b471be75d77130d10b4c425d192ae243e3940da32e5d6dca'; \ 46 | ;; \ 47 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 48 | esac; \ 49 | \ 50 | curl -fL -o openjdk.tgz "$downloadUrl"; \ 51 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 52 | \ 53 | mkdir -p "$JAVA_HOME"; \ 54 | tar --extract \ 55 | --file openjdk.tgz \ 56 | --directory "$JAVA_HOME" \ 57 | --strip-components 1 \ 58 | --no-same-owner \ 59 | ; \ 60 | rm openjdk.tgz*; \ 61 | \ 62 | rm -rf "$JAVA_HOME/lib/security/cacerts"; \ 63 | # see "update-ca-trust" script which creates/maintains this cacerts bundle 64 | ln -sT /etc/pki/ca-trust/extracted/java/cacerts "$JAVA_HOME/lib/security/cacerts"; \ 65 | \ 66 | # https://github.com/oracle/docker-images/blob/a56e0d1ed968ff669d2e2ba8a1483d0f3acc80c0/OracleJava/java-8/Dockerfile#L17-L19 67 | ln -sfT "$JAVA_HOME" /usr/java/default; \ 68 | ln -sfT "$JAVA_HOME" /usr/java/latest; \ 69 | for bin in "$JAVA_HOME/bin/"*; do \ 70 | base="$(basename "$bin")"; \ 71 | [ ! -e "/usr/bin/$base" ]; \ 72 | alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \ 73 | done; \ 74 | \ 75 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 76 | # https://openjdk.java.net/jeps/341 77 | java -Xshare:dump; \ 78 | \ 79 | # basic smoke test 80 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 81 | javac --version; \ 82 | java --version 83 | 84 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 85 | CMD ["jshell"] 86 | -------------------------------------------------------------------------------- /27/oraclelinux9/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM oraclelinux:9-slim 8 | 9 | RUN set -eux; \ 10 | microdnf install \ 11 | gzip \ 12 | tar \ 13 | \ 14 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 15 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 16 | binutils \ 17 | # java.lang.UnsatisfiedLinkError: /usr/java/openjdk-12/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 18 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 19 | freetype fontconfig \ 20 | ; \ 21 | microdnf clean all 22 | 23 | ENV JAVA_HOME /usr/java/openjdk-27 24 | ENV PATH $JAVA_HOME/bin:$PATH 25 | 26 | # Default to UTF-8 file.encoding 27 | ENV LANG C.UTF-8 28 | 29 | # https://jdk.java.net/ 30 | # > 31 | # > Java Development Kit builds, from Oracle 32 | # > 33 | ENV JAVA_VERSION 27-ea+2 34 | 35 | RUN set -eux; \ 36 | \ 37 | arch="$(rpm --query --queryformat='%{ARCH}' rpm)"; \ 38 | case "$arch" in \ 39 | 'x86_64') \ 40 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-x64_bin.tar.gz'; \ 41 | downloadSha256='95b0225ac04e0034ffe1626daf09cf436a54ac3b74fef67ccd00534beb7715f5'; \ 42 | ;; \ 43 | 'aarch64') \ 44 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-aarch64_bin.tar.gz'; \ 45 | downloadSha256='111a65a5acf09c18b471be75d77130d10b4c425d192ae243e3940da32e5d6dca'; \ 46 | ;; \ 47 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 48 | esac; \ 49 | \ 50 | curl -fL -o openjdk.tgz "$downloadUrl"; \ 51 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 52 | \ 53 | mkdir -p "$JAVA_HOME"; \ 54 | tar --extract \ 55 | --file openjdk.tgz \ 56 | --directory "$JAVA_HOME" \ 57 | --strip-components 1 \ 58 | --no-same-owner \ 59 | ; \ 60 | rm openjdk.tgz*; \ 61 | \ 62 | rm -rf "$JAVA_HOME/lib/security/cacerts"; \ 63 | # see "update-ca-trust" script which creates/maintains this cacerts bundle 64 | ln -sT /etc/pki/ca-trust/extracted/java/cacerts "$JAVA_HOME/lib/security/cacerts"; \ 65 | \ 66 | # https://github.com/oracle/docker-images/blob/a56e0d1ed968ff669d2e2ba8a1483d0f3acc80c0/OracleJava/java-8/Dockerfile#L17-L19 67 | ln -sfT "$JAVA_HOME" /usr/java/default; \ 68 | ln -sfT "$JAVA_HOME" /usr/java/latest; \ 69 | for bin in "$JAVA_HOME/bin/"*; do \ 70 | base="$(basename "$bin")"; \ 71 | [ ! -e "/usr/bin/$base" ]; \ 72 | alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \ 73 | done; \ 74 | \ 75 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 76 | # https://openjdk.java.net/jeps/341 77 | java -Xshare:dump; \ 78 | \ 79 | # basic smoke test 80 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 81 | javac --version; \ 82 | java --version 83 | 84 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 85 | CMD ["jshell"] 86 | -------------------------------------------------------------------------------- /26/oraclelinux8/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM oraclelinux:8-slim 8 | 9 | RUN set -eux; \ 10 | microdnf install \ 11 | gzip \ 12 | tar \ 13 | \ 14 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 15 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 16 | binutils \ 17 | # java.lang.UnsatisfiedLinkError: /usr/java/openjdk-12/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 18 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 19 | freetype fontconfig \ 20 | ; \ 21 | microdnf clean all 22 | 23 | ENV JAVA_HOME /usr/java/openjdk-26 24 | ENV PATH $JAVA_HOME/bin:$PATH 25 | 26 | # Default to UTF-8 file.encoding 27 | ENV LANG C.UTF-8 28 | 29 | # https://jdk.java.net/ 30 | # > 31 | # > Java Development Kit builds, from Oracle 32 | # > 33 | ENV JAVA_VERSION 26-ea+28 34 | 35 | RUN set -eux; \ 36 | \ 37 | arch="$(rpm --query --queryformat='%{ARCH}' rpm)"; \ 38 | case "$arch" in \ 39 | 'x86_64') \ 40 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-x64_bin.tar.gz'; \ 41 | downloadSha256='a18910b0bdceb12a4f78147a1feebee50cc621ad8114c07a1ab071e58c17b09d'; \ 42 | ;; \ 43 | 'aarch64') \ 44 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-aarch64_bin.tar.gz'; \ 45 | downloadSha256='d330a706e3fc611f4b39f6768f104e47d0a755ffabda31e3299dbc2e791f4f18'; \ 46 | ;; \ 47 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 48 | esac; \ 49 | \ 50 | curl -fL -o openjdk.tgz "$downloadUrl"; \ 51 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 52 | \ 53 | mkdir -p "$JAVA_HOME"; \ 54 | tar --extract \ 55 | --file openjdk.tgz \ 56 | --directory "$JAVA_HOME" \ 57 | --strip-components 1 \ 58 | --no-same-owner \ 59 | ; \ 60 | rm openjdk.tgz*; \ 61 | \ 62 | rm -rf "$JAVA_HOME/lib/security/cacerts"; \ 63 | # see "update-ca-trust" script which creates/maintains this cacerts bundle 64 | ln -sT /etc/pki/ca-trust/extracted/java/cacerts "$JAVA_HOME/lib/security/cacerts"; \ 65 | \ 66 | # https://github.com/oracle/docker-images/blob/a56e0d1ed968ff669d2e2ba8a1483d0f3acc80c0/OracleJava/java-8/Dockerfile#L17-L19 67 | ln -sfT "$JAVA_HOME" /usr/java/default; \ 68 | ln -sfT "$JAVA_HOME" /usr/java/latest; \ 69 | for bin in "$JAVA_HOME/bin/"*; do \ 70 | base="$(basename "$bin")"; \ 71 | [ ! -e "/usr/bin/$base" ]; \ 72 | alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \ 73 | done; \ 74 | \ 75 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 76 | # https://openjdk.java.net/jeps/341 77 | java -Xshare:dump; \ 78 | \ 79 | # basic smoke test 80 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 81 | javac --version; \ 82 | java --version 83 | 84 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 85 | CMD ["jshell"] 86 | -------------------------------------------------------------------------------- /26/oraclelinux9/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM oraclelinux:9-slim 8 | 9 | RUN set -eux; \ 10 | microdnf install \ 11 | gzip \ 12 | tar \ 13 | \ 14 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 15 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 16 | binutils \ 17 | # java.lang.UnsatisfiedLinkError: /usr/java/openjdk-12/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 18 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 19 | freetype fontconfig \ 20 | ; \ 21 | microdnf clean all 22 | 23 | ENV JAVA_HOME /usr/java/openjdk-26 24 | ENV PATH $JAVA_HOME/bin:$PATH 25 | 26 | # Default to UTF-8 file.encoding 27 | ENV LANG C.UTF-8 28 | 29 | # https://jdk.java.net/ 30 | # > 31 | # > Java Development Kit builds, from Oracle 32 | # > 33 | ENV JAVA_VERSION 26-ea+28 34 | 35 | RUN set -eux; \ 36 | \ 37 | arch="$(rpm --query --queryformat='%{ARCH}' rpm)"; \ 38 | case "$arch" in \ 39 | 'x86_64') \ 40 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-x64_bin.tar.gz'; \ 41 | downloadSha256='a18910b0bdceb12a4f78147a1feebee50cc621ad8114c07a1ab071e58c17b09d'; \ 42 | ;; \ 43 | 'aarch64') \ 44 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-aarch64_bin.tar.gz'; \ 45 | downloadSha256='d330a706e3fc611f4b39f6768f104e47d0a755ffabda31e3299dbc2e791f4f18'; \ 46 | ;; \ 47 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 48 | esac; \ 49 | \ 50 | curl -fL -o openjdk.tgz "$downloadUrl"; \ 51 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 52 | \ 53 | mkdir -p "$JAVA_HOME"; \ 54 | tar --extract \ 55 | --file openjdk.tgz \ 56 | --directory "$JAVA_HOME" \ 57 | --strip-components 1 \ 58 | --no-same-owner \ 59 | ; \ 60 | rm openjdk.tgz*; \ 61 | \ 62 | rm -rf "$JAVA_HOME/lib/security/cacerts"; \ 63 | # see "update-ca-trust" script which creates/maintains this cacerts bundle 64 | ln -sT /etc/pki/ca-trust/extracted/java/cacerts "$JAVA_HOME/lib/security/cacerts"; \ 65 | \ 66 | # https://github.com/oracle/docker-images/blob/a56e0d1ed968ff669d2e2ba8a1483d0f3acc80c0/OracleJava/java-8/Dockerfile#L17-L19 67 | ln -sfT "$JAVA_HOME" /usr/java/default; \ 68 | ln -sfT "$JAVA_HOME" /usr/java/latest; \ 69 | for bin in "$JAVA_HOME/bin/"*; do \ 70 | base="$(basename "$bin")"; \ 71 | [ ! -e "/usr/bin/$base" ]; \ 72 | alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \ 73 | done; \ 74 | \ 75 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 76 | # https://openjdk.java.net/jeps/341 77 | java -Xshare:dump; \ 78 | \ 79 | # basic smoke test 80 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 81 | javac --version; \ 82 | java --version 83 | 84 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 85 | CMD ["jshell"] 86 | -------------------------------------------------------------------------------- /26/windows/windowsservercore-ltsc2022/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/servercore:ltsc2022 8 | 9 | # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 10 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 11 | 12 | # enable TLS 1.2 13 | # https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801 14 | # https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12 15 | RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \ 16 | $tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \ 17 | if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \ 18 | New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \ 19 | New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \ 20 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 21 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 22 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 23 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 24 | Write-Host 'Complete.' 25 | 26 | ENV JAVA_HOME C:\\openjdk-26 27 | RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ 28 | Write-Host ('Updating PATH: {0}' -f $newPath); \ 29 | setx /M PATH $newPath; \ 30 | Write-Host 'Complete.' 31 | 32 | # https://jdk.java.net/ 33 | # > 34 | # > Java Development Kit builds, from Oracle 35 | # > 36 | ENV JAVA_VERSION 26-ea+28 37 | ENV JAVA_URL https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_windows-x64_bin.zip 38 | ENV JAVA_SHA256 1043a56a8e09613f76543d6e9290ff5c53e9cc2bcf0053550a36ad993843bf2c 39 | 40 | RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ 41 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ 42 | Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \ 43 | Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_SHA256); \ 44 | if ((Get-FileHash openjdk.zip -Algorithm sha256).Hash -ne $env:JAVA_SHA256) { \ 45 | Write-Host 'FAILED!'; \ 46 | exit 1; \ 47 | }; \ 48 | \ 49 | Write-Host 'Expanding ...'; \ 50 | New-Item -ItemType Directory -Path C:\temp | Out-Null; \ 51 | Expand-Archive openjdk.zip -DestinationPath C:\temp; \ 52 | Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ 53 | Remove-Item C:\temp; \ 54 | \ 55 | Write-Host 'Removing ...'; \ 56 | Remove-Item openjdk.zip -Force; \ 57 | \ 58 | Write-Host 'Verifying install ...'; \ 59 | Write-Host ' javac --version'; javac --version; \ 60 | Write-Host ' java --version'; java --version; \ 61 | \ 62 | Write-Host 'Complete.' 63 | 64 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 65 | CMD ["jshell"] 66 | -------------------------------------------------------------------------------- /26/windows/windowsservercore-ltsc2025/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/servercore:ltsc2025 8 | 9 | # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 10 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 11 | 12 | # enable TLS 1.2 13 | # https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801 14 | # https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12 15 | RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \ 16 | $tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \ 17 | if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \ 18 | New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \ 19 | New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \ 20 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 21 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 22 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 23 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 24 | Write-Host 'Complete.' 25 | 26 | ENV JAVA_HOME C:\\openjdk-26 27 | RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ 28 | Write-Host ('Updating PATH: {0}' -f $newPath); \ 29 | setx /M PATH $newPath; \ 30 | Write-Host 'Complete.' 31 | 32 | # https://jdk.java.net/ 33 | # > 34 | # > Java Development Kit builds, from Oracle 35 | # > 36 | ENV JAVA_VERSION 26-ea+28 37 | ENV JAVA_URL https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_windows-x64_bin.zip 38 | ENV JAVA_SHA256 1043a56a8e09613f76543d6e9290ff5c53e9cc2bcf0053550a36ad993843bf2c 39 | 40 | RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ 41 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ 42 | Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \ 43 | Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_SHA256); \ 44 | if ((Get-FileHash openjdk.zip -Algorithm sha256).Hash -ne $env:JAVA_SHA256) { \ 45 | Write-Host 'FAILED!'; \ 46 | exit 1; \ 47 | }; \ 48 | \ 49 | Write-Host 'Expanding ...'; \ 50 | New-Item -ItemType Directory -Path C:\temp | Out-Null; \ 51 | Expand-Archive openjdk.zip -DestinationPath C:\temp; \ 52 | Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ 53 | Remove-Item C:\temp; \ 54 | \ 55 | Write-Host 'Removing ...'; \ 56 | Remove-Item openjdk.zip -Force; \ 57 | \ 58 | Write-Host 'Verifying install ...'; \ 59 | Write-Host ' javac --version'; javac --version; \ 60 | Write-Host ' java --version'; java --version; \ 61 | \ 62 | Write-Host 'Complete.' 63 | 64 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 65 | CMD ["jshell"] 66 | -------------------------------------------------------------------------------- /27/windows/windowsservercore-ltsc2022/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/servercore:ltsc2022 8 | 9 | # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 10 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 11 | 12 | # enable TLS 1.2 13 | # https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801 14 | # https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12 15 | RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \ 16 | $tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \ 17 | if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \ 18 | New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \ 19 | New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \ 20 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 21 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 22 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 23 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 24 | Write-Host 'Complete.' 25 | 26 | ENV JAVA_HOME C:\\openjdk-27 27 | RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ 28 | Write-Host ('Updating PATH: {0}' -f $newPath); \ 29 | setx /M PATH $newPath; \ 30 | Write-Host 'Complete.' 31 | 32 | # https://jdk.java.net/ 33 | # > 34 | # > Java Development Kit builds, from Oracle 35 | # > 36 | ENV JAVA_VERSION 27-ea+2 37 | ENV JAVA_URL https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_windows-x64_bin.zip 38 | ENV JAVA_SHA256 486eb3681d48770501631da706141ae22a0bc408cb4899e2370656479dd8ebfd 39 | 40 | RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ 41 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ 42 | Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \ 43 | Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_SHA256); \ 44 | if ((Get-FileHash openjdk.zip -Algorithm sha256).Hash -ne $env:JAVA_SHA256) { \ 45 | Write-Host 'FAILED!'; \ 46 | exit 1; \ 47 | }; \ 48 | \ 49 | Write-Host 'Expanding ...'; \ 50 | New-Item -ItemType Directory -Path C:\temp | Out-Null; \ 51 | Expand-Archive openjdk.zip -DestinationPath C:\temp; \ 52 | Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ 53 | Remove-Item C:\temp; \ 54 | \ 55 | Write-Host 'Removing ...'; \ 56 | Remove-Item openjdk.zip -Force; \ 57 | \ 58 | Write-Host 'Verifying install ...'; \ 59 | Write-Host ' javac --version'; javac --version; \ 60 | Write-Host ' java --version'; java --version; \ 61 | \ 62 | Write-Host 'Complete.' 63 | 64 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 65 | CMD ["jshell"] 66 | -------------------------------------------------------------------------------- /27/windows/windowsservercore-ltsc2025/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM mcr.microsoft.com/windows/servercore:ltsc2025 8 | 9 | # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 10 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 11 | 12 | # enable TLS 1.2 13 | # https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801 14 | # https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12 15 | RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \ 16 | $tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \ 17 | if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \ 18 | New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \ 19 | New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \ 20 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 21 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 22 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 23 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 24 | Write-Host 'Complete.' 25 | 26 | ENV JAVA_HOME C:\\openjdk-27 27 | RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ 28 | Write-Host ('Updating PATH: {0}' -f $newPath); \ 29 | setx /M PATH $newPath; \ 30 | Write-Host 'Complete.' 31 | 32 | # https://jdk.java.net/ 33 | # > 34 | # > Java Development Kit builds, from Oracle 35 | # > 36 | ENV JAVA_VERSION 27-ea+2 37 | ENV JAVA_URL https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_windows-x64_bin.zip 38 | ENV JAVA_SHA256 486eb3681d48770501631da706141ae22a0bc408cb4899e2370656479dd8ebfd 39 | 40 | RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ 41 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ 42 | Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \ 43 | Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_SHA256); \ 44 | if ((Get-FileHash openjdk.zip -Algorithm sha256).Hash -ne $env:JAVA_SHA256) { \ 45 | Write-Host 'FAILED!'; \ 46 | exit 1; \ 47 | }; \ 48 | \ 49 | Write-Host 'Expanding ...'; \ 50 | New-Item -ItemType Directory -Path C:\temp | Out-Null; \ 51 | Expand-Archive openjdk.zip -DestinationPath C:\temp; \ 52 | Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ 53 | Remove-Item C:\temp; \ 54 | \ 55 | Write-Host 'Removing ...'; \ 56 | Remove-Item openjdk.zip -Force; \ 57 | \ 58 | Write-Host 'Verifying install ...'; \ 59 | Write-Host ' javac --version'; javac --version; \ 60 | Write-Host ' java --version'; java --version; \ 61 | \ 62 | Write-Host 'Complete.' 63 | 64 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 65 | CMD ["jshell"] 66 | -------------------------------------------------------------------------------- /generate-stackbrew-library.jq: -------------------------------------------------------------------------------- 1 | to_entries 2 | 3 | | .[] 4 | | .key as $major 5 | | .value 6 | 7 | | if $ARGS.positional | length > 0 then 8 | select(IN($major; $ARGS.positional[])) 9 | else . end 10 | 11 | | ( 12 | .version 13 | | gsub("[+]"; "-") 14 | # if fullVersion is only digits, add "-rc" to the end (because we're probably in the final-phases of pre-release before GA when we drop support from the image) 15 | | if test("^[0-9.]+$") then 16 | . + "-rc" 17 | else . end 18 | | if contains("-ea") or contains("-rc") then . else 19 | error("invalid version; too GA: \(.) (\($major))") 20 | end 21 | ) as $version 22 | 23 | # generate a list of "version tags", stopping the vector at the first "-ea" or "-rc" component suffix 24 | # "AA-ea-BB.CC" -> [ "AA-ea-BB.CC", "AA-ea-BB", "AA-ea" ] 25 | | [ 26 | $version 27 | | [ scan("(?x) ^[0-9a-z]+ | [.-][0-9a-z]+") ] # [ "AA", "-ea", "-BB", ".CC" ] 28 | | label $stopEarly 29 | | .[:length-range(length)] # [ "AA", "-ea", "-BB", ".CC" ], [ "AA", "-ea", "-BB" ], ... 30 | | add # "AA-ea-BB.CC", "AA-ea-BB", "AA-ea", "AA" 31 | | if endswith("-ea") or endswith("-rc") then 32 | ., break $stopEarly 33 | else . end 34 | ] as $versionTags 35 | 36 | # now inject all the "-jdk" variations of those too 37 | | ($versionTags | map(. + "-jdk", .)) as $versionTags 38 | 39 | | first(.variants[] | select(startswith("oraclelinux"))) as $latestOracle 40 | | first(.variants[] | select(startswith("slim-"))) as $latestSlim 41 | 42 | | .variants[] as $variant # "oraclelinux9", "slim-trixie", "windows/windowsservercore-ltsc2025" 43 | 44 | | ($variant | split("/")[-1]) as $variantName # "windowsservercore-ltsc2025", etc 45 | 46 | | [ 47 | $variantName, 48 | 49 | if $variant == $latestOracle then 50 | "oracle" 51 | else empty end, 52 | 53 | if $variant == $latestSlim then 54 | "slim" 55 | else empty end, 56 | 57 | empty 58 | 59 | | $versionTags[] as $versionTag 60 | | [ $versionTag, . | select(. != "") ] 61 | | join("-") 62 | ] as $tags 63 | 64 | | [ 65 | if $variant | startswith("windows/") then 66 | $variantName | split("-")[0] 67 | else empty end, 68 | 69 | if $variant == $latestOracle or ($variant | startswith("windows/windowsservercore-")) then 70 | "" 71 | else empty end, 72 | 73 | empty 74 | 75 | | $versionTags[] as $versionTag 76 | | [ $versionTag, . | select(. != "") ] 77 | | join("-") 78 | ] as $sharedTags 79 | 80 | | ( 81 | .arches 82 | | keys_unsorted 83 | | map(select( 84 | startswith("windows-") 85 | | if $variant | startswith("windows/") then . else not end 86 | )) 87 | ) as $arches 88 | 89 | | ( 90 | "", 91 | "Tags: \($tags | join(", "))", 92 | if $sharedTags != [] then "SharedTags: \($sharedTags | join(", "))" else empty end, 93 | "Directory: \($major)/\($variant)", 94 | "Architectures: \($arches | join(", "))", 95 | if $variant | startswith("windows/") then 96 | $variant 97 | | split("-")[-1] as $winver 98 | | [ 99 | if startswith("windows/nanoserver-") then 100 | "nanoserver-" + $winver 101 | else empty end, 102 | "windowsservercore-" + $winver, 103 | empty 104 | ] 105 | | "Constraints: " + join(", ") 106 | else empty end, 107 | empty 108 | ) 109 | -------------------------------------------------------------------------------- /27/slim-trixie/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:trixie-slim 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | # utilities for keeping Debian and OpenJDK CA certificates in sync 13 | ca-certificates p11-kit \ 14 | ; \ 15 | rm -rf /var/lib/apt/lists/* 16 | 17 | ENV JAVA_HOME /usr/local/openjdk-27 18 | ENV PATH $JAVA_HOME/bin:$PATH 19 | 20 | # Default to UTF-8 file.encoding 21 | ENV LANG C.UTF-8 22 | 23 | # https://jdk.java.net/ 24 | # > 25 | # > Java Development Kit builds, from Oracle 26 | # > 27 | ENV JAVA_VERSION 27-ea+2 28 | 29 | RUN set -eux; \ 30 | \ 31 | arch="$(dpkg --print-architecture)"; \ 32 | case "$arch" in \ 33 | 'amd64') \ 34 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-x64_bin.tar.gz'; \ 35 | downloadSha256='95b0225ac04e0034ffe1626daf09cf436a54ac3b74fef67ccd00534beb7715f5'; \ 36 | ;; \ 37 | 'arm64') \ 38 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-aarch64_bin.tar.gz'; \ 39 | downloadSha256='111a65a5acf09c18b471be75d77130d10b4c425d192ae243e3940da32e5d6dca'; \ 40 | ;; \ 41 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 42 | esac; \ 43 | \ 44 | savedAptMark="$(apt-mark showmanual)"; \ 45 | apt-get update; \ 46 | apt-get install -y --no-install-recommends \ 47 | wget \ 48 | ; \ 49 | rm -rf /var/lib/apt/lists/*; \ 50 | \ 51 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 52 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 53 | \ 54 | mkdir -p "$JAVA_HOME"; \ 55 | tar --extract \ 56 | --file openjdk.tgz \ 57 | --directory "$JAVA_HOME" \ 58 | --strip-components 1 \ 59 | --no-same-owner \ 60 | ; \ 61 | rm openjdk.tgz*; \ 62 | \ 63 | apt-mark auto '.*' > /dev/null; \ 64 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 65 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 66 | \ 67 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 68 | # see https://github.com/docker-library/openjdk/issues/327 69 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 70 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 71 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 72 | { \ 73 | echo '#!/usr/bin/env bash'; \ 74 | echo 'set -Eeuo pipefail'; \ 75 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 76 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 77 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 78 | /etc/ca-certificates/update.d/docker-openjdk; \ 79 | \ 80 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 81 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 82 | ldconfig; \ 83 | \ 84 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 85 | # https://openjdk.java.net/jeps/341 86 | java -Xshare:dump; \ 87 | \ 88 | # basic smoke test 89 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 90 | javac --version; \ 91 | java --version 92 | 93 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 94 | CMD ["jshell"] 95 | -------------------------------------------------------------------------------- /26/slim-trixie/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:trixie-slim 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | # utilities for keeping Debian and OpenJDK CA certificates in sync 13 | ca-certificates p11-kit \ 14 | ; \ 15 | rm -rf /var/lib/apt/lists/* 16 | 17 | ENV JAVA_HOME /usr/local/openjdk-26 18 | ENV PATH $JAVA_HOME/bin:$PATH 19 | 20 | # Default to UTF-8 file.encoding 21 | ENV LANG C.UTF-8 22 | 23 | # https://jdk.java.net/ 24 | # > 25 | # > Java Development Kit builds, from Oracle 26 | # > 27 | ENV JAVA_VERSION 26-ea+28 28 | 29 | RUN set -eux; \ 30 | \ 31 | arch="$(dpkg --print-architecture)"; \ 32 | case "$arch" in \ 33 | 'amd64') \ 34 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-x64_bin.tar.gz'; \ 35 | downloadSha256='a18910b0bdceb12a4f78147a1feebee50cc621ad8114c07a1ab071e58c17b09d'; \ 36 | ;; \ 37 | 'arm64') \ 38 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-aarch64_bin.tar.gz'; \ 39 | downloadSha256='d330a706e3fc611f4b39f6768f104e47d0a755ffabda31e3299dbc2e791f4f18'; \ 40 | ;; \ 41 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 42 | esac; \ 43 | \ 44 | savedAptMark="$(apt-mark showmanual)"; \ 45 | apt-get update; \ 46 | apt-get install -y --no-install-recommends \ 47 | wget \ 48 | ; \ 49 | rm -rf /var/lib/apt/lists/*; \ 50 | \ 51 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 52 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 53 | \ 54 | mkdir -p "$JAVA_HOME"; \ 55 | tar --extract \ 56 | --file openjdk.tgz \ 57 | --directory "$JAVA_HOME" \ 58 | --strip-components 1 \ 59 | --no-same-owner \ 60 | ; \ 61 | rm openjdk.tgz*; \ 62 | \ 63 | apt-mark auto '.*' > /dev/null; \ 64 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 65 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 66 | \ 67 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 68 | # see https://github.com/docker-library/openjdk/issues/327 69 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 70 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 71 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 72 | { \ 73 | echo '#!/usr/bin/env bash'; \ 74 | echo 'set -Eeuo pipefail'; \ 75 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 76 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 77 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 78 | /etc/ca-certificates/update.d/docker-openjdk; \ 79 | \ 80 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 81 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 82 | ldconfig; \ 83 | \ 84 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 85 | # https://openjdk.java.net/jeps/341 86 | java -Xshare:dump; \ 87 | \ 88 | # basic smoke test 89 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 90 | javac --version; \ 91 | java --version 92 | 93 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 94 | CMD ["jshell"] 95 | -------------------------------------------------------------------------------- /27/slim-bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:bookworm-slim 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | # utilities for keeping Debian and OpenJDK CA certificates in sync 13 | ca-certificates p11-kit \ 14 | ; \ 15 | rm -rf /var/lib/apt/lists/* 16 | 17 | ENV JAVA_HOME /usr/local/openjdk-27 18 | ENV PATH $JAVA_HOME/bin:$PATH 19 | 20 | # Default to UTF-8 file.encoding 21 | ENV LANG C.UTF-8 22 | 23 | # https://jdk.java.net/ 24 | # > 25 | # > Java Development Kit builds, from Oracle 26 | # > 27 | ENV JAVA_VERSION 27-ea+2 28 | 29 | RUN set -eux; \ 30 | \ 31 | arch="$(dpkg --print-architecture)"; \ 32 | case "$arch" in \ 33 | 'amd64') \ 34 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-x64_bin.tar.gz'; \ 35 | downloadSha256='95b0225ac04e0034ffe1626daf09cf436a54ac3b74fef67ccd00534beb7715f5'; \ 36 | ;; \ 37 | 'arm64') \ 38 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-aarch64_bin.tar.gz'; \ 39 | downloadSha256='111a65a5acf09c18b471be75d77130d10b4c425d192ae243e3940da32e5d6dca'; \ 40 | ;; \ 41 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 42 | esac; \ 43 | \ 44 | savedAptMark="$(apt-mark showmanual)"; \ 45 | apt-get update; \ 46 | apt-get install -y --no-install-recommends \ 47 | wget \ 48 | ; \ 49 | rm -rf /var/lib/apt/lists/*; \ 50 | \ 51 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 52 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 53 | \ 54 | mkdir -p "$JAVA_HOME"; \ 55 | tar --extract \ 56 | --file openjdk.tgz \ 57 | --directory "$JAVA_HOME" \ 58 | --strip-components 1 \ 59 | --no-same-owner \ 60 | ; \ 61 | rm openjdk.tgz*; \ 62 | \ 63 | apt-mark auto '.*' > /dev/null; \ 64 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 65 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 66 | \ 67 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 68 | # see https://github.com/docker-library/openjdk/issues/327 69 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 70 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 71 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 72 | { \ 73 | echo '#!/usr/bin/env bash'; \ 74 | echo 'set -Eeuo pipefail'; \ 75 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 76 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 77 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 78 | /etc/ca-certificates/update.d/docker-openjdk; \ 79 | \ 80 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 81 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 82 | ldconfig; \ 83 | \ 84 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 85 | # https://openjdk.java.net/jeps/341 86 | java -Xshare:dump; \ 87 | \ 88 | # basic smoke test 89 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 90 | javac --version; \ 91 | java --version 92 | 93 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 94 | CMD ["jshell"] 95 | -------------------------------------------------------------------------------- /26/slim-bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:bookworm-slim 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | # utilities for keeping Debian and OpenJDK CA certificates in sync 13 | ca-certificates p11-kit \ 14 | ; \ 15 | rm -rf /var/lib/apt/lists/* 16 | 17 | ENV JAVA_HOME /usr/local/openjdk-26 18 | ENV PATH $JAVA_HOME/bin:$PATH 19 | 20 | # Default to UTF-8 file.encoding 21 | ENV LANG C.UTF-8 22 | 23 | # https://jdk.java.net/ 24 | # > 25 | # > Java Development Kit builds, from Oracle 26 | # > 27 | ENV JAVA_VERSION 26-ea+28 28 | 29 | RUN set -eux; \ 30 | \ 31 | arch="$(dpkg --print-architecture)"; \ 32 | case "$arch" in \ 33 | 'amd64') \ 34 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-x64_bin.tar.gz'; \ 35 | downloadSha256='a18910b0bdceb12a4f78147a1feebee50cc621ad8114c07a1ab071e58c17b09d'; \ 36 | ;; \ 37 | 'arm64') \ 38 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-aarch64_bin.tar.gz'; \ 39 | downloadSha256='d330a706e3fc611f4b39f6768f104e47d0a755ffabda31e3299dbc2e791f4f18'; \ 40 | ;; \ 41 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 42 | esac; \ 43 | \ 44 | savedAptMark="$(apt-mark showmanual)"; \ 45 | apt-get update; \ 46 | apt-get install -y --no-install-recommends \ 47 | wget \ 48 | ; \ 49 | rm -rf /var/lib/apt/lists/*; \ 50 | \ 51 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 52 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 53 | \ 54 | mkdir -p "$JAVA_HOME"; \ 55 | tar --extract \ 56 | --file openjdk.tgz \ 57 | --directory "$JAVA_HOME" \ 58 | --strip-components 1 \ 59 | --no-same-owner \ 60 | ; \ 61 | rm openjdk.tgz*; \ 62 | \ 63 | apt-mark auto '.*' > /dev/null; \ 64 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 65 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 66 | \ 67 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 68 | # see https://github.com/docker-library/openjdk/issues/327 69 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 70 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 71 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 72 | { \ 73 | echo '#!/usr/bin/env bash'; \ 74 | echo 'set -Eeuo pipefail'; \ 75 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 76 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 77 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 78 | /etc/ca-certificates/update.d/docker-openjdk; \ 79 | \ 80 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 81 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 82 | ldconfig; \ 83 | \ 84 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 85 | # https://openjdk.java.net/jeps/341 86 | java -Xshare:dump; \ 87 | \ 88 | # basic smoke test 89 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 90 | javac --version; \ 91 | java --version 92 | 93 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 94 | CMD ["jshell"] 95 | -------------------------------------------------------------------------------- /27/trixie/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM buildpack-deps:trixie-scm 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | bzip2 \ 13 | unzip \ 14 | xz-utils \ 15 | \ 16 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 17 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 18 | binutils \ 19 | \ 20 | # java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 21 | # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager 22 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 23 | fontconfig libfreetype6 \ 24 | \ 25 | # utilities for keeping Debian and OpenJDK CA certificates in sync 26 | ca-certificates p11-kit \ 27 | ; \ 28 | rm -rf /var/lib/apt/lists/* 29 | 30 | ENV JAVA_HOME /usr/local/openjdk-27 31 | ENV PATH $JAVA_HOME/bin:$PATH 32 | 33 | # Default to UTF-8 file.encoding 34 | ENV LANG C.UTF-8 35 | 36 | # https://jdk.java.net/ 37 | # > 38 | # > Java Development Kit builds, from Oracle 39 | # > 40 | ENV JAVA_VERSION 27-ea+2 41 | 42 | RUN set -eux; \ 43 | \ 44 | arch="$(dpkg --print-architecture)"; \ 45 | case "$arch" in \ 46 | 'amd64') \ 47 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-x64_bin.tar.gz'; \ 48 | downloadSha256='95b0225ac04e0034ffe1626daf09cf436a54ac3b74fef67ccd00534beb7715f5'; \ 49 | ;; \ 50 | 'arm64') \ 51 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-aarch64_bin.tar.gz'; \ 52 | downloadSha256='111a65a5acf09c18b471be75d77130d10b4c425d192ae243e3940da32e5d6dca'; \ 53 | ;; \ 54 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 55 | esac; \ 56 | \ 57 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 58 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 59 | \ 60 | mkdir -p "$JAVA_HOME"; \ 61 | tar --extract \ 62 | --file openjdk.tgz \ 63 | --directory "$JAVA_HOME" \ 64 | --strip-components 1 \ 65 | --no-same-owner \ 66 | ; \ 67 | rm openjdk.tgz*; \ 68 | \ 69 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 70 | # see https://github.com/docker-library/openjdk/issues/327 71 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 72 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 73 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 74 | { \ 75 | echo '#!/usr/bin/env bash'; \ 76 | echo 'set -Eeuo pipefail'; \ 77 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 78 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 79 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 80 | /etc/ca-certificates/update.d/docker-openjdk; \ 81 | \ 82 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 83 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 84 | ldconfig; \ 85 | \ 86 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 87 | # https://openjdk.java.net/jeps/341 88 | java -Xshare:dump; \ 89 | \ 90 | # basic smoke test 91 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 92 | javac --version; \ 93 | java --version 94 | 95 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 96 | CMD ["jshell"] 97 | -------------------------------------------------------------------------------- /26/trixie/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM buildpack-deps:trixie-scm 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | bzip2 \ 13 | unzip \ 14 | xz-utils \ 15 | \ 16 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 17 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 18 | binutils \ 19 | \ 20 | # java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 21 | # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager 22 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 23 | fontconfig libfreetype6 \ 24 | \ 25 | # utilities for keeping Debian and OpenJDK CA certificates in sync 26 | ca-certificates p11-kit \ 27 | ; \ 28 | rm -rf /var/lib/apt/lists/* 29 | 30 | ENV JAVA_HOME /usr/local/openjdk-26 31 | ENV PATH $JAVA_HOME/bin:$PATH 32 | 33 | # Default to UTF-8 file.encoding 34 | ENV LANG C.UTF-8 35 | 36 | # https://jdk.java.net/ 37 | # > 38 | # > Java Development Kit builds, from Oracle 39 | # > 40 | ENV JAVA_VERSION 26-ea+28 41 | 42 | RUN set -eux; \ 43 | \ 44 | arch="$(dpkg --print-architecture)"; \ 45 | case "$arch" in \ 46 | 'amd64') \ 47 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-x64_bin.tar.gz'; \ 48 | downloadSha256='a18910b0bdceb12a4f78147a1feebee50cc621ad8114c07a1ab071e58c17b09d'; \ 49 | ;; \ 50 | 'arm64') \ 51 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-aarch64_bin.tar.gz'; \ 52 | downloadSha256='d330a706e3fc611f4b39f6768f104e47d0a755ffabda31e3299dbc2e791f4f18'; \ 53 | ;; \ 54 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 55 | esac; \ 56 | \ 57 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 58 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 59 | \ 60 | mkdir -p "$JAVA_HOME"; \ 61 | tar --extract \ 62 | --file openjdk.tgz \ 63 | --directory "$JAVA_HOME" \ 64 | --strip-components 1 \ 65 | --no-same-owner \ 66 | ; \ 67 | rm openjdk.tgz*; \ 68 | \ 69 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 70 | # see https://github.com/docker-library/openjdk/issues/327 71 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 72 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 73 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 74 | { \ 75 | echo '#!/usr/bin/env bash'; \ 76 | echo 'set -Eeuo pipefail'; \ 77 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 78 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 79 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 80 | /etc/ca-certificates/update.d/docker-openjdk; \ 81 | \ 82 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 83 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 84 | ldconfig; \ 85 | \ 86 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 87 | # https://openjdk.java.net/jeps/341 88 | java -Xshare:dump; \ 89 | \ 90 | # basic smoke test 91 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 92 | javac --version; \ 93 | java --version 94 | 95 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 96 | CMD ["jshell"] 97 | -------------------------------------------------------------------------------- /27/bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM buildpack-deps:bookworm-scm 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | bzip2 \ 13 | unzip \ 14 | xz-utils \ 15 | \ 16 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 17 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 18 | binutils \ 19 | \ 20 | # java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 21 | # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager 22 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 23 | fontconfig libfreetype6 \ 24 | \ 25 | # utilities for keeping Debian and OpenJDK CA certificates in sync 26 | ca-certificates p11-kit \ 27 | ; \ 28 | rm -rf /var/lib/apt/lists/* 29 | 30 | ENV JAVA_HOME /usr/local/openjdk-27 31 | ENV PATH $JAVA_HOME/bin:$PATH 32 | 33 | # Default to UTF-8 file.encoding 34 | ENV LANG C.UTF-8 35 | 36 | # https://jdk.java.net/ 37 | # > 38 | # > Java Development Kit builds, from Oracle 39 | # > 40 | ENV JAVA_VERSION 27-ea+2 41 | 42 | RUN set -eux; \ 43 | \ 44 | arch="$(dpkg --print-architecture)"; \ 45 | case "$arch" in \ 46 | 'amd64') \ 47 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-x64_bin.tar.gz'; \ 48 | downloadSha256='95b0225ac04e0034ffe1626daf09cf436a54ac3b74fef67ccd00534beb7715f5'; \ 49 | ;; \ 50 | 'arm64') \ 51 | downloadUrl='https://download.java.net/java/early_access/jdk27/2/GPL/openjdk-27-ea+2_linux-aarch64_bin.tar.gz'; \ 52 | downloadSha256='111a65a5acf09c18b471be75d77130d10b4c425d192ae243e3940da32e5d6dca'; \ 53 | ;; \ 54 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 55 | esac; \ 56 | \ 57 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 58 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 59 | \ 60 | mkdir -p "$JAVA_HOME"; \ 61 | tar --extract \ 62 | --file openjdk.tgz \ 63 | --directory "$JAVA_HOME" \ 64 | --strip-components 1 \ 65 | --no-same-owner \ 66 | ; \ 67 | rm openjdk.tgz*; \ 68 | \ 69 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 70 | # see https://github.com/docker-library/openjdk/issues/327 71 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 72 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 73 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 74 | { \ 75 | echo '#!/usr/bin/env bash'; \ 76 | echo 'set -Eeuo pipefail'; \ 77 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 78 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 79 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 80 | /etc/ca-certificates/update.d/docker-openjdk; \ 81 | \ 82 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 83 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 84 | ldconfig; \ 85 | \ 86 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 87 | # https://openjdk.java.net/jeps/341 88 | java -Xshare:dump; \ 89 | \ 90 | # basic smoke test 91 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 92 | javac --version; \ 93 | java --version 94 | 95 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 96 | CMD ["jshell"] 97 | -------------------------------------------------------------------------------- /26/bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM buildpack-deps:bookworm-scm 8 | 9 | RUN set -eux; \ 10 | apt-get update; \ 11 | apt-get install -y --no-install-recommends \ 12 | bzip2 \ 13 | unzip \ 14 | xz-utils \ 15 | \ 16 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 17 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 18 | binutils \ 19 | \ 20 | # java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 21 | # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager 22 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 23 | fontconfig libfreetype6 \ 24 | \ 25 | # utilities for keeping Debian and OpenJDK CA certificates in sync 26 | ca-certificates p11-kit \ 27 | ; \ 28 | rm -rf /var/lib/apt/lists/* 29 | 30 | ENV JAVA_HOME /usr/local/openjdk-26 31 | ENV PATH $JAVA_HOME/bin:$PATH 32 | 33 | # Default to UTF-8 file.encoding 34 | ENV LANG C.UTF-8 35 | 36 | # https://jdk.java.net/ 37 | # > 38 | # > Java Development Kit builds, from Oracle 39 | # > 40 | ENV JAVA_VERSION 26-ea+28 41 | 42 | RUN set -eux; \ 43 | \ 44 | arch="$(dpkg --print-architecture)"; \ 45 | case "$arch" in \ 46 | 'amd64') \ 47 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-x64_bin.tar.gz'; \ 48 | downloadSha256='a18910b0bdceb12a4f78147a1feebee50cc621ad8114c07a1ab071e58c17b09d'; \ 49 | ;; \ 50 | 'arm64') \ 51 | downloadUrl='https://download.java.net/java/early_access/jdk26/28/GPL/openjdk-26-ea+28_linux-aarch64_bin.tar.gz'; \ 52 | downloadSha256='d330a706e3fc611f4b39f6768f104e47d0a755ffabda31e3299dbc2e791f4f18'; \ 53 | ;; \ 54 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 55 | esac; \ 56 | \ 57 | wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ 58 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 59 | \ 60 | mkdir -p "$JAVA_HOME"; \ 61 | tar --extract \ 62 | --file openjdk.tgz \ 63 | --directory "$JAVA_HOME" \ 64 | --strip-components 1 \ 65 | --no-same-owner \ 66 | ; \ 67 | rm openjdk.tgz*; \ 68 | \ 69 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 70 | # see https://github.com/docker-library/openjdk/issues/327 71 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 72 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 73 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 74 | { \ 75 | echo '#!/usr/bin/env bash'; \ 76 | echo 'set -Eeuo pipefail'; \ 77 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 78 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 79 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 80 | /etc/ca-certificates/update.d/docker-openjdk; \ 81 | \ 82 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 83 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 84 | ldconfig; \ 85 | \ 86 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 87 | # https://openjdk.java.net/jeps/341 88 | java -Xshare:dump; \ 89 | \ 90 | # basic smoke test 91 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 92 | javac --version; \ 93 | java --version 94 | 95 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 96 | CMD ["jshell"] 97 | -------------------------------------------------------------------------------- /Dockerfile-windows.template: -------------------------------------------------------------------------------- 1 | {{ 2 | def windows_variant: # "servercore", "nanoserver" 3 | env.variant 4 | | split("/")[-1] 5 | | split("-")[0] 6 | | ltrimstr("windows") 7 | ; 8 | def windows_release: # "ltsc2025", "ltsc2022" 9 | env.variant 10 | | split("-")[-1] 11 | -}} 12 | FROM mcr.microsoft.com/windows/{{ windows_variant }}:{{ windows_release }} 13 | 14 | {{ if windows_variant == "servercore" then ( -}} 15 | # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 16 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] 17 | 18 | # enable TLS 1.2 19 | # https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801 20 | # https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12 21 | RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \ 22 | $tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \ 23 | if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \ 24 | New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \ 25 | New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \ 26 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 27 | New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 28 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ 29 | New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ 30 | Write-Host 'Complete.' 31 | 32 | ENV JAVA_HOME C:\\openjdk-{{ env.version }} 33 | RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ 34 | Write-Host ('Updating PATH: {0}' -f $newPath); \ 35 | setx /M PATH $newPath; \ 36 | Write-Host 'Complete.' 37 | {{ ) else ( -}} 38 | SHELL ["cmd", "/s", "/c"] 39 | 40 | ENV JAVA_HOME C:\\openjdk-{{ env.version }} 41 | # "ERROR: Access to the registry path is denied." 42 | USER ContainerAdministrator 43 | RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \ 44 | && setx /M PATH %JAVA_HOME%\bin;%PATH% \ 45 | && echo Complete. 46 | USER ContainerUser 47 | {{ ) end -}} 48 | 49 | # https://jdk.java.net/ 50 | # > 51 | # > Java Development Kit builds, from Oracle 52 | # > 53 | ENV JAVA_VERSION {{ .version }} 54 | {{ if windows_variant == "servercore" then ( -}} 55 | {{ # TODO $env:PROCESSOR_ARCHITECTURE for arm64v8 someday (https://superuser.com/a/1441469/101945) -}} 56 | ENV JAVA_URL {{ .arches["windows-amd64"].url }} 57 | {{ if .arches["windows-amd64"] | has("sha256") then ( -}} 58 | ENV JAVA_SHA256 {{ .arches["windows-amd64"].sha256 }} 59 | {{ ) else "" end -}} 60 | {{ ) else "" end -}} 61 | 62 | {{ if windows_variant == "servercore" then ( -}} 63 | RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ 64 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ 65 | Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \ 66 | {{ if .arches["windows-amd64"] | has("sha256") then ( -}} 67 | Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_SHA256); \ 68 | if ((Get-FileHash openjdk.zip -Algorithm sha256).Hash -ne $env:JAVA_SHA256) { \ 69 | Write-Host 'FAILED!'; \ 70 | exit 1; \ 71 | }; \ 72 | {{ ) else ( -}} 73 | # TODO signature? checksum? 74 | {{ ) end -}} 75 | \ 76 | Write-Host 'Expanding ...'; \ 77 | New-Item -ItemType Directory -Path C:\temp | Out-Null; \ 78 | Expand-Archive openjdk.zip -DestinationPath C:\temp; \ 79 | Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ 80 | Remove-Item C:\temp; \ 81 | \ 82 | Write-Host 'Removing ...'; \ 83 | Remove-Item openjdk.zip -Force; \ 84 | \ 85 | Write-Host 'Verifying install ...'; \ 86 | Write-Host ' javac --version'; javac --version; \ 87 | Write-Host ' java --version'; java --version; \ 88 | \ 89 | Write-Host 'Complete.' 90 | {{ ) else ( -}} 91 | COPY --from=openjdk:{{ .version | gsub("[+]"; "-") }}-windowsservercore-{{ windows_release }} $JAVA_HOME $JAVA_HOME 92 | 93 | RUN echo Verifying install ... \ 94 | && echo javac --version && javac --version \ 95 | && echo java --version && java --version \ 96 | && echo Complete. 97 | {{ ) end -}} 98 | 99 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 100 | CMD ["jshell"] 101 | -------------------------------------------------------------------------------- /versions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | versions=( "$@" ) 7 | if [ ${#versions[@]} -eq 0 ]; then 8 | versions=( */ ) 9 | json='{}' 10 | else 11 | json="$(< versions.json)" 12 | fi 13 | versions=( "${versions[@]%/}" ) 14 | 15 | tmp="$(mktemp -d)" 16 | rmTmp="$(printf 'rm -rf %q' "$tmp")" 17 | trap "$rmTmp" EXIT 18 | 19 | _get() { 20 | local url="$1"; shift 21 | local file="${url////_}" 22 | file="${file//%/_}" 23 | file="${file//+/_}" 24 | file="${file//:/_}" 25 | file="$tmp/$file" 26 | if [ ! -s "$file" ]; then 27 | curl -fsSL "$url" -o "$file" --retry 5 || return 1 28 | fi 29 | if [ "$#" -gt 0 ]; then 30 | grep "$@" "$file" 31 | else 32 | cat "$file" 33 | fi 34 | } 35 | 36 | abs-url() { 37 | local url="$1"; shift 38 | local base="$1"; shift 39 | 40 | case "$url" in 41 | http://* | https://* ) ;; 42 | 43 | /*) 44 | local extra="${base#*://*/}" 45 | local baseBase="${base%$extra}" 46 | baseBase="${baseBase%/}" 47 | url="$baseBase$url" 48 | ;; 49 | 50 | *) 51 | echo >&2 "error: TODO parse '$url' relative to '$base'" 52 | exit 1 53 | ;; 54 | esac 55 | 56 | echo "$url" 57 | } 58 | 59 | jdk-java-net-download-url() { 60 | local javaVersion="$1"; shift 61 | local fileSuffix="$1"; shift 62 | _get "https://jdk.java.net/$javaVersion/" \ 63 | -Eom1 "https://download.java.net/[^\"]+$fileSuffix" 64 | } 65 | 66 | jdk-java-net-download-version() { 67 | local javaVersion="$1"; shift 68 | local downloadUrl="$1"; shift 69 | 70 | downloadVersion="$(grep -Eom1 "openjdk-$javaVersion[^_]*_" <<<"$downloadUrl")" || return 1 71 | downloadVersion="${downloadVersion%_}" 72 | downloadVersion="${downloadVersion#openjdk-}" 73 | 74 | echo "$downloadVersion" 75 | } 76 | 77 | # see https://stackoverflow.com/a/2705678/433558 78 | sed_escape_rhs() { 79 | sed -e 's/[\/&]/\\&/g' <<<"$*" | sed -e ':a;N;$!ba;s/\n/\\n/g' 80 | } 81 | sed_s() { 82 | local lhs="$1"; shift 83 | local rhs="$1"; shift 84 | rhs="$(sed_escape_rhs "$rhs")" 85 | echo -n "s/$lhs/$rhs/g" 86 | } 87 | sed_s_pre() { 88 | local lhs="$1"; shift 89 | local rhs="$1"; shift 90 | rhs="$(sed_escape_rhs "$rhs")" 91 | echo -n "s/^($lhs) .*$/\1 $rhs/" 92 | } 93 | 94 | for version in "${versions[@]}"; do 95 | export version 96 | doc='{}' 97 | possibleArches=( 98 | # https://jdk.java.net/26/ 99 | 'linux-x64' 100 | 'linux-aarch64' 101 | 'windows-x64' 102 | ) 103 | for arch in "${possibleArches[@]}"; do 104 | downloadSuffix="_${arch}_bin" 105 | case "$arch" in 106 | linux-*) downloadSuffix+='.tar.gz'; bashbrewArch= ;; 107 | windows-*) downloadSuffix+='.zip'; bashbrewArch='windows-' ;; 108 | *) echo >&2 "error: unknown Oracle arch: '$arch'"; exit 1 ;; 109 | esac 110 | if downloadUrl="$(jdk-java-net-download-url "$version" "$downloadSuffix")" \ 111 | && [ -n "$downloadUrl" ] \ 112 | && downloadSha256="$(_get "$downloadUrl.sha256")" \ 113 | && [ -n "$downloadSha256" ] \ 114 | ; then 115 | downloadVersion="$(jdk-java-net-download-version "$version" "$downloadUrl")" 116 | currentVersion="$(jq <<<"$doc" -r '.version // ""')" 117 | if [ -n "$currentVersion" ] && [ "$currentVersion" != "$downloadVersion" ]; then 118 | echo >&2 "error: Oracle version mismatch: '$currentVersion' vs '$downloadVersion'" 119 | exit 1 120 | elif [ -z "$currentVersion" ]; then 121 | echo "$version: $downloadVersion" 122 | fi 123 | case "$arch" in 124 | *-aarch64*) bashbrewArch+='arm64v8' ;; 125 | *-x64*) bashbrewArch+='amd64' ;; 126 | *) echo >&2 "error: unknown Oracle arch: '$arch'"; exit 1 ;; 127 | esac 128 | export arch bashbrewArch downloadUrl downloadSha256 downloadVersion 129 | doc="$(jq <<<"$doc" -c ' 130 | .version = env.downloadVersion 131 | | .arches[env.bashbrewArch] = { 132 | url: env.downloadUrl, 133 | sha256: env.downloadSha256, 134 | } 135 | ')" 136 | fi 137 | done 138 | 139 | if ! jq <<<"$doc" -e '[ .. | objects | select(has("arches")) | .arches | has("amd64") ] | all' &> /dev/null; then 140 | echo >&2 "error: missing 'amd64' for '$version'; cowardly refusing to continue! (because this is almost always a scraping flake or similar bug)" 141 | exit 1 142 | fi 143 | 144 | json="$(jq <<<"$json" -c --argjson doc "$doc" ' 145 | .[env.version] = $doc + { 146 | variants: [ 147 | ( 148 | "9", 149 | "8", 150 | empty 151 | | "oraclelinux" + .), 152 | ( 153 | "trixie", 154 | "bookworm", 155 | empty 156 | | ., "slim-" + .), 157 | if $doc.arches | keys | any(startswith("windows-")) then 158 | ( 159 | "ltsc2025", 160 | "ltsc2022", 161 | empty 162 | | "windows/windowsservercore-" + .), 163 | ( 164 | "ltsc2025", 165 | "ltsc2022", 166 | empty 167 | | "windows/nanoserver-" + .) 168 | else empty end 169 | ], 170 | } 171 | ')" 172 | done 173 | 174 | jq <<<"$json" . > versions.json 175 | -------------------------------------------------------------------------------- /Dockerfile-linux.template: -------------------------------------------------------------------------------- 1 | {{ 2 | def is_oracle: 3 | env.variant | startswith("oraclelinux") 4 | ; 5 | def oracle_version: 6 | env.variant | ltrimstr("oraclelinux") 7 | ; 8 | def is_debian_slim: 9 | env.variant | startswith("slim-") 10 | ; 11 | def debian_suite: 12 | env.variant | ltrimstr("slim-") 13 | -}} 14 | {{ 15 | if is_oracle then ( 16 | -}} 17 | FROM oraclelinux:{{ oracle_version }}-slim 18 | 19 | RUN set -eux; \ 20 | microdnf install \ 21 | gzip \ 22 | tar \ 23 | \ 24 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 25 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 26 | binutils \ 27 | # java.lang.UnsatisfiedLinkError: /usr/java/openjdk-12/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 28 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 29 | freetype fontconfig \ 30 | ; \ 31 | microdnf clean all 32 | 33 | ENV JAVA_HOME /usr/java/openjdk-{{ env.version }} 34 | {{ 35 | ) else ( 36 | -}} 37 | FROM {{ 38 | if is_debian_slim then 39 | "debian:" + debian_suite + "-slim" 40 | else 41 | "buildpack-deps:" + debian_suite + "-scm" 42 | end 43 | }} 44 | 45 | RUN set -eux; \ 46 | apt-get update; \ 47 | apt-get install -y --no-install-recommends \ 48 | {{ if is_debian_slim then "" else ( -}} 49 | bzip2 \ 50 | unzip \ 51 | xz-utils \ 52 | \ 53 | # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 54 | # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory 55 | binutils \ 56 | \ 57 | # java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory 58 | # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager 59 | # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 60 | fontconfig libfreetype6 \ 61 | \ 62 | {{ ) end -}} 63 | # utilities for keeping Debian and OpenJDK CA certificates in sync 64 | ca-certificates p11-kit \ 65 | ; \ 66 | rm -rf /var/lib/apt/lists/* 67 | 68 | ENV JAVA_HOME /usr/local/openjdk-{{ env.version }} 69 | {{ 70 | ) end 71 | -}} 72 | ENV PATH $JAVA_HOME/bin:$PATH 73 | 74 | # Default to UTF-8 file.encoding 75 | ENV LANG C.UTF-8 76 | 77 | # https://jdk.java.net/ 78 | # > 79 | # > Java Development Kit builds, from Oracle 80 | # > 81 | ENV JAVA_VERSION {{ .version }} 82 | 83 | {{ 84 | def get_arch_command: 85 | if is_oracle then 86 | "rpm --query --queryformat='%{ARCH}' rpm" 87 | else 88 | "dpkg --print-architecture" 89 | end 90 | ; 91 | def case_arch: 92 | # input is a bashbrew arch 93 | # - "amd64", "arm64v8", etc 94 | # output is a shell "case" expression for matching the output of running "get_arch_command" 95 | # - "i[3456]86", "aarch64", "x86_64", etc 96 | . as $bashbrewArch 97 | | if is_oracle then { 98 | amd64: "x86_64", 99 | arm64v8: "aarch64", 100 | } else { 101 | amd64: "amd64", 102 | arm64v8: "arm64", 103 | } end 104 | | .[$bashbrewArch] // error("unsupported bashbrew architecture: " + $bashbrewArch) 105 | | @sh 106 | ; 107 | def wget_command: 108 | if is_oracle then 109 | "curl -fL -o" 110 | else 111 | "wget --progress=dot:giga -O" 112 | end 113 | -}} 114 | RUN set -eux; \ 115 | \ 116 | arch="$({{ get_arch_command }})"; \ 117 | case "$arch" in \ 118 | {{ 119 | [ 120 | .arches 121 | | to_entries[] 122 | | select(.key | startswith("windows-") | not) 123 | | .key as $bashbrewArch | .value 124 | | ( 125 | -}} 126 | {{ $bashbrewArch | case_arch }}) \ 127 | downloadUrl={{ .url | @sh }}; \ 128 | {{ if .sha256 then ( -}} 129 | downloadSha256={{ .sha256 | @sh }}; \ 130 | {{ ) else "" end -}} 131 | ;; \ 132 | {{ 133 | ) 134 | ] | add 135 | -}} 136 | *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ 137 | esac; \ 138 | \ 139 | {{ if is_debian_slim then ( -}} 140 | savedAptMark="$(apt-mark showmanual)"; \ 141 | apt-get update; \ 142 | apt-get install -y --no-install-recommends \ 143 | wget \ 144 | ; \ 145 | rm -rf /var/lib/apt/lists/*; \ 146 | \ 147 | {{ ) else "" end -}} 148 | {{ wget_command }} openjdk.tgz "$downloadUrl"; \ 149 | {{ if .arches | any(has("sha256")) then ( -}} 150 | echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ 151 | {{ ) else "" end -}} 152 | \ 153 | mkdir -p "$JAVA_HOME"; \ 154 | tar --extract \ 155 | --file openjdk.tgz \ 156 | --directory "$JAVA_HOME" \ 157 | --strip-components 1 \ 158 | --no-same-owner \ 159 | ; \ 160 | rm openjdk.tgz*; \ 161 | \ 162 | {{ if is_debian_slim then ( -}} 163 | apt-mark auto '.*' > /dev/null; \ 164 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ 165 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 166 | \ 167 | {{ ) else "" end -}} 168 | {{ if is_oracle then ( -}} 169 | rm -rf "$JAVA_HOME/lib/security/cacerts"; \ 170 | # see "update-ca-trust" script which creates/maintains this cacerts bundle 171 | ln -sT /etc/pki/ca-trust/extracted/java/cacerts "$JAVA_HOME/lib/security/cacerts"; \ 172 | \ 173 | # https://github.com/oracle/docker-images/blob/a56e0d1ed968ff669d2e2ba8a1483d0f3acc80c0/OracleJava/java-8/Dockerfile#L17-L19 174 | ln -sfT "$JAVA_HOME" /usr/java/default; \ 175 | ln -sfT "$JAVA_HOME" /usr/java/latest; \ 176 | for bin in "$JAVA_HOME/bin/"*; do \ 177 | base="$(basename "$bin")"; \ 178 | [ ! -e "/usr/bin/$base" ]; \ 179 | alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \ 180 | done; \ 181 | {{ ) else ( -}} 182 | # update "cacerts" bundle to use Debian's CA certificates (and make sure it stays up-to-date with changes to Debian's store) 183 | # see https://github.com/docker-library/openjdk/issues/327 184 | # http://rabexc.org/posts/certificates-not-working-java#comment-4099504075 185 | # https://salsa.debian.org/java-team/ca-certificates-java/blob/3e51a84e9104823319abeb31f880580e46f45a98/debian/jks-keystore.hook.in 186 | # https://git.alpinelinux.org/aports/tree/community/java-cacerts/APKBUILD?id=761af65f38b4570093461e6546dcf6b179d2b624#n29 187 | { \ 188 | echo '#!/usr/bin/env bash'; \ 189 | echo 'set -Eeuo pipefail'; \ 190 | echo 'trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$JAVA_HOME/lib/security/cacerts"'; \ 191 | } > /etc/ca-certificates/update.d/docker-openjdk; \ 192 | chmod +x /etc/ca-certificates/update.d/docker-openjdk; \ 193 | /etc/ca-certificates/update.d/docker-openjdk; \ 194 | \ 195 | # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 196 | find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ 197 | ldconfig; \ 198 | {{ ) end -}} 199 | \ 200 | # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 201 | # https://openjdk.java.net/jeps/341 202 | java -Xshare:dump; \ 203 | \ 204 | # basic smoke test 205 | fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ 206 | javac --version; \ 207 | java --version 208 | 209 | # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) 210 | CMD ["jshell"] 211 | --------------------------------------------------------------------------------