Skip to content

Commit 19e8a8e

Browse files
authored
Merge branch 'oracle:main' into main
2 parents 49b2992 + 2bf806b commit 19e8a8e

21 files changed

+212
-505
lines changed

OracleJava/11/Dockerfile

Lines changed: 0 additions & 90 deletions
This file was deleted.

OracleJava/11/Dockerfile.ol8

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,92 @@
1-
# Copyright (c) 2019, 2024 Oracle and/or its affiliates.
1+
# Copyright (c) 2019, 2025 Oracle and/or its affiliates.
22
#
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
#
55
# ORACLE DOCKERFILES PROJECT
66
# --------------------------
77
# This is the Dockerfile for Oracle JDK 11 on Oracle Linux 8
88
#
9+
# ARGS
10+
# ----
11+
# This docker file requires two arguments:
12+
# 1) JDK11_TOKEN is a valid dowload token for JDK 11. It can be created in cloud.oracle.com/jms under Java Download
13+
# Token generation is documented on https://docs.cloud.oracle.com/en-us/iaas/jms/doc/java-download.html
14+
# 2) OCI_REGION is the Oracle Cloud Infrastucture (OCI) region where the token is generated.
15+
#
916
# REQUIRED FILES TO BUILD THIS IMAGE
1017
# ----------------------------------
18+
# This dockerfile will download a copy of latest version of JDK 11 from
19+
# https://javamanagementservice-download.<OCI_REGION>.oci.oraclecloud.com/java/11/latest/
1120
#
12-
# (1) jdk-11.XX_linux-x64_bin.tar.gz or jdk-11.XX_linux-aarch64_bin.tar.gz
13-
# Download from https://www.oracle.com/java/technologies/downloads/
21+
# It will use either x64 or aarch64 depending on the target platform
1422
#
1523
# HOW TO BUILD THIS IMAGE
1624
# -----------------------
17-
# Put all downloaded files in the same directory as this Dockerfile
1825
# Run:
19-
# $ docker build -t oracle/jdk:11 .
20-
#
21-
# This command is already scripted in build.sh so you can alternatively run
22-
# $ bash build.sh 8
26+
# $ docker build --file Dockerfile.ol8 --tag oracle/jdk:11 --build-arg JDK11_TOKEN=<token> --build-arg OCI_REGION=<region> .
2327
#
2428
# The builder image will be used to uncompress the tar.gz file with the Java Runtime.
2529

2630
FROM oraclelinux:8 as builder
31+
ARG JDK11_TOKEN
32+
ARG OCI_REGION
2733

2834
LABEL maintainer="Aurelio Garcia-Ribeyro <aurelio.garciaribeyro@oracle.com>"
2935

36+
# Since the files are compressed as tar.gz first dnf install tar.
37+
# gzip is already in oraclelinux:8
3038
RUN dnf install -y tar
3139

3240
# Default to UTF-8 file.encoding
3341
ENV LANG en_US.UTF-8
3442

35-
3643
# Environment variables for the builder image.
3744
# Required to validate that you are using the correct file
3845

39-
ENV JAVA_HOME=/usr/java/jdk-11
46+
ENV JAVA_URL=https://javamanagementservice-download."${OCI_REGION}".oci.oraclecloud.com/java/11/latest/ \
47+
JAVA_HOME=/usr/java/jdk-11
4048

41-
##
42-
COPY *.tar.gz /tmp/
4349
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4450
RUN set -eux; \
4551
ARCH="$(uname -m)" && \
52+
# Java uses just x64 in the name of the tarball
4653
if [ "$ARCH" = "x86_64" ]; \
47-
then \
48-
mv "$(ls /tmp/jdk-11*_linux-x64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
49-
JAVA_SHA256=d22d0fcca761861a1eb2f5f6eb116c933354e8b1f76b3cda189c722cc0177c98 ; \
50-
else \
51-
mv "$(ls /tmp/jdk-11*_linux-aarch64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
52-
JAVA_SHA256=3fc0d93f6363d32723c293ba5a9016e8ab27410351ed804020cfe71e87d3bc0a ; \
54+
then ARCH="x64"; \
5355
fi && \
54-
echo "$JAVA_SHA256 */tmp/jdk.tar.gz" | sha256sum -c -; \
56+
JAVA_PKG="$JAVA_URL"jdk-11_linux-"${ARCH}"_bin.tar.gz; \
57+
JAVA_SHA256="$(curl -L "$JAVA_PKG".sha256)" ; \
58+
curl -L --header token:${JDK11_TOKEN} --output /tmp/jdk.tgz "$JAVA_PKG" && \
59+
echo "$JAVA_SHA256" */tmp/jdk.tgz | sha256sum -c; \
5560
mkdir -p "$JAVA_HOME"; \
56-
tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
61+
tar --extract --file /tmp/jdk.tgz --directory "$JAVA_HOME" --strip-components 1
5762

5863
## Get a fresh version of Oracle Linux 8 for the final image
5964
FROM oraclelinux:8
6065

6166
# Default to UTF-8 file.encoding
6267
ENV LANG en_US.UTF-8
63-
6468
ENV JAVA_HOME=/usr/java/jdk-11
65-
6669
ENV PATH $JAVA_HOME/bin:$PATH
6770

6871
# Copy the uncompressed Java Runtime from the builder image
6972
COPY --from=builder $JAVA_HOME $JAVA_HOME
7073

7174
RUN set -eux; \
75+
# Ensure we get the latest OL 8 updates available at build time
7276
dnf -y update; \
7377
dnf install -y \
74-
# JDK assumes freetype is available
75-
freetype fontconfig \
78+
# JDK assumes freetype is available
79+
freetype fontconfig \
7680
; \
7781
rm -rf /var/cache/dnf; \
7882
ln -sfT "$JAVA_HOME" /usr/java/default; \
7983
ln -sfT "$JAVA_HOME" /usr/java/latest; \
8084
for bin in "$JAVA_HOME/bin/"*; do \
81-
base="$(basename "$bin")"; \
82-
[ ! -e "/usr/bin/$base" ]; \
83-
alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \
85+
base="$(basename "$bin")"; \
86+
[ ! -e "/usr/bin/$base" ]; \
87+
alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \
8488
done; \
85-
# -Xshare:dump will create a CDS archive to improve startup in subsequent runs
89+
# -Xshare:dump will create a CDS archive to improve startup in subsequent runs
8690
java -Xshare:dump;
8791

8892
CMD ["jshell"]

OracleJava/11/build.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

OracleJava/17/Dockerfile

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)