|
| 1 | +# ------------------------------------------------------------------------------ |
| 2 | +# NOTE: THIS FILE IS GENERATED VIA "generate_dockerfiles.py" |
| 3 | +# |
| 4 | +# PLEASE DO NOT EDIT IT DIRECTLY. |
| 5 | +# ------------------------------------------------------------------------------ |
| 6 | +# |
| 7 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +# you may not use this file except in compliance with the License. |
| 9 | +# You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, software |
| 14 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +# See the License for the specific language governing permissions and |
| 17 | +# limitations under the License. |
| 18 | +# |
| 19 | + |
| 20 | +FROM alpine:3.21 |
| 21 | + |
| 22 | +ENV JAVA_HOME=/opt/java/openjdk |
| 23 | +ENV PATH=$JAVA_HOME/bin:$PATH |
| 24 | + |
| 25 | +# Default to UTF-8 file.encoding |
| 26 | +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' |
| 27 | + |
| 28 | +RUN set -eux; \ |
| 29 | + apk add --no-cache \ |
| 30 | + # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory |
| 31 | + # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager |
| 32 | + # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 |
| 33 | + fontconfig ttf-dejavu \ |
| 34 | + # gnupg required to verify the signature |
| 35 | + gnupg \ |
| 36 | + # utilities for keeping Alpine and OpenJDK CA certificates in sync |
| 37 | + # https://github.com/adoptium/containers/issues/293 |
| 38 | + ca-certificates p11-kit-trust \ |
| 39 | + # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 |
| 40 | + musl-locales musl-locales-lang \ |
| 41 | + # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 |
| 42 | + # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory |
| 43 | + binutils \ |
| 44 | + tzdata \ |
| 45 | + # Contains `csplit` used for splitting multiple certificates in one file to multiple files, since keytool can |
| 46 | + # only import one at a time. |
| 47 | + coreutils \ |
| 48 | + # Needed to extract CN and generate aliases for certificates |
| 49 | + openssl \ |
| 50 | + ; \ |
| 51 | + rm -rf /var/cache/apk/* |
| 52 | + |
| 53 | +ENV JAVA_VERSION=jdk-17.0.13+11 |
| 54 | + |
| 55 | +RUN set -eux; \ |
| 56 | + ARCH="$(apk --print-arch)"; \ |
| 57 | + case "${ARCH}" in \ |
| 58 | + x86_64) \ |
| 59 | + ESUM='67632ee4563e9827b56f62ab6da95bce200d9e82092b211988c0d2113abc4071'; \ |
| 60 | + BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_alpine-linux_hotspot_17.0.13_11.tar.gz'; \ |
| 61 | + ;; \ |
| 62 | + *) \ |
| 63 | + echo "Unsupported arch: ${ARCH}"; \ |
| 64 | + exit 1; \ |
| 65 | + ;; \ |
| 66 | + esac; \ |
| 67 | + wget -O /tmp/openjdk.tar.gz ${BINARY_URL}; \ |
| 68 | + wget -O /tmp/openjdk.tar.gz.sig ${BINARY_URL}.sig; \ |
| 69 | + export GNUPGHOME="$(mktemp -d)"; \ |
| 70 | + # gpg: key 843C48A565F8F04B: "Adoptium GPG Key (DEB/RPM Signing Key) <[email protected]>" imported |
| 71 | + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 3B04D753C9050D9A5D343F39843C48A565F8F04B; \ |
| 72 | + gpg --batch --verify /tmp/openjdk.tar.gz.sig /tmp/openjdk.tar.gz; \ |
| 73 | + rm -rf "${GNUPGHOME}" /tmp/openjdk.tar.gz.sig; \ |
| 74 | + echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \ |
| 75 | + mkdir -p "$JAVA_HOME"; \ |
| 76 | + tar --extract \ |
| 77 | + --file /tmp/openjdk.tar.gz \ |
| 78 | + --directory "$JAVA_HOME" \ |
| 79 | + --strip-components 1 \ |
| 80 | + --no-same-owner \ |
| 81 | + ; \ |
| 82 | + rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/lib/src.zip; |
| 83 | + |
| 84 | +RUN set -eux; \ |
| 85 | + echo "Verifying install ..."; \ |
| 86 | + fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ |
| 87 | + echo "javac --version"; javac --version; \ |
| 88 | + echo "java --version"; java --version; \ |
| 89 | + echo "Complete." |
| 90 | +COPY --chmod=755 entrypoint.sh /__cacert_entrypoint.sh |
| 91 | +ENTRYPOINT ["/__cacert_entrypoint.sh"] |
| 92 | + |
| 93 | +CMD ["jshell"] |
0 commit comments