Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: © 2022 Matthias Andreas Benkard <code@mail.matthias.benkard.de> |
| 2 | # |
| 3 | # SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
Matthias Andreas Benkard | 0acc589 | 2022-06-10 06:12:15 +0200 | [diff] [blame] | 5 | FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS ubi-minimal |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 6 | |
| 7 | # Add OpenJDK (complete). |
| 8 | ADD jdk-dist/latest.tar.gz /jdk |
| 9 | |
| 10 | # JLink a trimmed JDK. |
| 11 | RUN microdnf --assumeyes --nodocs install binutils |
| 12 | RUN /jdk/*/bin/jlink \ |
| 13 | -J-XX:MaxRAMPercentage=75 \ |
Matthias Andreas Benkard | 776cee3 | 2022-05-13 22:27:08 +0200 | [diff] [blame] | 14 | --add-modules ALL-MODULE-PATH \ |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 15 | --compress=1 \ |
| 16 | --no-man-pages \ |
| 17 | --strip-debug \ |
| 18 | --output /java |
| 19 | RUN /java/bin/java -Xshare:dump |
| 20 | |
| 21 | # Set mtimes to @0 for reproducibility. |
| 22 | RUN microdnf --assumeyes --nodocs install findutils |
| 23 | RUN find /java -exec touch --date=@0 '{}' ';' |
| 24 | |
| 25 | # Build the final image. |
Matthias Andreas Benkard | 0acc589 | 2022-06-10 06:12:15 +0200 | [diff] [blame] | 26 | FROM registry.access.redhat.com/ubi9/ubi-micro:latest |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 27 | COPY --from=ubi-minimal /lib64/libz.so.1 /lib64/ |
| 28 | COPY --from=ubi-minimal /java /java |
| 29 | ENV JAVA_HOME=/java |
| 30 | ENV PATH=/java/bin:$PATH |