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