blob: 4672be75bb6f67e6ddb343b79126c2dec680bbc1 [file] [log] [blame]
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +02001# SPDX-FileCopyrightText: © 2022 Matthias Andreas Benkard <code@mail.matthias.benkard.de>
2#
3# SPDX-License-Identifier: GPL-3.0-or-later
4
Matthias Andreas Benkard0acc5892022-06-10 06:12:15 +02005FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS ubi-minimal
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +02006
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 \
Matthias Andreas Benkard776cee32022-05-13 22:27:08 +020014 --add-modules ALL-MODULE-PATH \
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +020015 --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.
Matthias Andreas Benkard0acc5892022-06-10 06:12:15 +020026FROM registry.access.redhat.com/ubi9/ubi-micro:latest
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +020027COPY --from=ubi-minimal /lib64/libz.so.1 /lib64/
28COPY --from=ubi-minimal /java /java
29ENV JAVA_HOME=/java
30ENV PATH=/java/bin:$PATH