Skip to content

Commit 21e364b

Browse files
2 parents 7ae930c + 801bdcb commit 21e364b

File tree

18 files changed

+313
-318
lines changed

18 files changed

+313
-318
lines changed

OracleJava/11/Dockerfile

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2023 Oracle and/or its affiliates.
1+
# Copyright (c) 2019, 2024 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
#
@@ -19,7 +19,7 @@
1919
# $ docker build -t oracle/jdk:11 .
2020
#
2121
# This command is already scripted in build.sh so you can alternatively run
22-
# $ bash build.sh
22+
# $ bash build.sh
2323
#
2424
# The builder image will be used to uncompress the tar.gz file with the Java Runtime.
2525

@@ -28,8 +28,8 @@ FROM oraclelinux:7-slim as builder
2828
LABEL maintainer="Aurelio Garcia-Ribeyro <[email protected]>"
2929

3030
RUN yum install -y gzip tar
31-
32-
31+
32+
3333
# Default to UTF-8 file.encoding
3434
ENV LANG en_US.UTF-8
3535

@@ -43,48 +43,48 @@ ENV JAVA_HOME=/usr/java/jdk-11
4343
COPY *.tar.gz /tmp/
4444
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4545
RUN set -eux; \
46-
ARCH="$(uname -m)" && \
46+
ARCH="$(uname -m)" && \
4747
if [ "$ARCH" = "x86_64" ]; \
4848
then \
49-
mv "$(ls /tmp/jdk-11*_linux-x64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
50-
JAVA_SHA256=f50fdec8a48a9b360d30ecc29af36f63f04f0b70ec829d3bf821e4e361682791 ; \
49+
mv "$(ls /tmp/jdk-11*_linux-x64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
50+
JAVA_SHA256=d22d0fcca761861a1eb2f5f6eb116c933354e8b1f76b3cda189c722cc0177c98 ; \
5151
else \
52-
mv "$(ls /tmp/jdk-11*_linux-aarch64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
53-
JAVA_SHA256=ff0c3387f47ed2eff9fdf936952573113824fc29de463bb13a3a804cc13d2ae8 ; \
52+
mv "$(ls /tmp/jdk-11*_linux-aarch64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
53+
JAVA_SHA256=3fc0d93f6363d32723c293ba5a9016e8ab27410351ed804020cfe71e87d3bc0a ; \
5454
fi && \
55-
echo "$JAVA_SHA256 */tmp/jdk.tar.gz" | sha256sum -c -; \
56-
mkdir -p "$JAVA_HOME"; \
57-
tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
58-
59-
## Get a fresh version of SLIM for the final image
55+
echo "$JAVA_SHA256 */tmp/jdk.tar.gz" | sha256sum -c -; \
56+
mkdir -p "$JAVA_HOME"; \
57+
tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
58+
59+
## Get a fresh version of Oracle Linux 7-slim for the final image
6060
FROM oraclelinux:7-slim
6161

6262
# Default to UTF-8 file.encoding
6363
ENV LANG en_US.UTF-8
6464

6565
ENV JAVA_HOME=/usr/java/jdk-11
6666

67-
ENV PATH $JAVA_HOME/bin:$PATH
67+
ENV PATH $JAVA_HOME/bin:$PATH
6868

6969
# Copy the uncompressed Java Runtime from the builder image
7070
COPY --from=builder $JAVA_HOME $JAVA_HOME
7171

7272
RUN set -eux; \
7373
# Update the base image
74-
yum -y update; \
75-
yum install -y \
76-
# JDK assumes freetype is available
77-
freetype fontconfig \
78-
; \
79-
rm -rf /var/cache/yum; \
80-
ln -sfT "$JAVA_HOME" /usr/java/default; \
81-
ln -sfT "$JAVA_HOME" /usr/java/latest; \
82-
for bin in "$JAVA_HOME/bin/"*; do \
83-
base="$(basename "$bin")"; \
84-
[ ! -e "/usr/bin/$base" ]; \
85-
alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \
86-
done; \
87-
# -Xshare:dump will create a CDS archive to improve startup in subsequent runs
88-
java -Xshare:dump;
74+
yum -y update; \
75+
yum install -y \
76+
# JDK assumes freetype is available
77+
freetype fontconfig \
78+
; \
79+
rm -rf /var/cache/yum; \
80+
ln -sfT "$JAVA_HOME" /usr/java/default; \
81+
ln -sfT "$JAVA_HOME" /usr/java/latest; \
82+
for bin in "$JAVA_HOME/bin/"*; do \
83+
base="$(basename "$bin")"; \
84+
[ ! -e "/usr/bin/$base" ]; \
85+
alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \
86+
done; \
87+
# -Xshare:dump will create a CDS archive to improve startup in subsequent runs
88+
java -Xshare:dump;
8989

9090
CMD ["jshell"]

OracleJava/11/Dockerfile.ol8

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2023 Oracle and/or its affiliates.
1+
# Copyright (c) 2019, 2024 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
#
@@ -19,7 +19,7 @@
1919
# $ docker build -t oracle/jdk:11 .
2020
#
2121
# This command is already scripted in build.sh so you can alternatively run
22-
# $ bash build.sh 8
22+
# $ bash build.sh 8
2323
#
2424
# The builder image will be used to uncompress the tar.gz file with the Java Runtime.
2525

@@ -42,47 +42,47 @@ ENV JAVA_HOME=/usr/java/jdk-11
4242
COPY *.tar.gz /tmp/
4343
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4444
RUN set -eux; \
45-
ARCH="$(uname -m)" && \
45+
ARCH="$(uname -m)" && \
4646
if [ "$ARCH" = "x86_64" ]; \
4747
then \
48-
mv "$(ls /tmp/jdk-11*_linux-x64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
49-
JAVA_SHA256=f50fdec8a48a9b360d30ecc29af36f63f04f0b70ec829d3bf821e4e361682791 ; \
48+
mv "$(ls /tmp/jdk-11*_linux-x64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
49+
JAVA_SHA256=d22d0fcca761861a1eb2f5f6eb116c933354e8b1f76b3cda189c722cc0177c98 ; \
5050
else \
51-
mv "$(ls /tmp/jdk-11*_linux-aarch64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
52-
JAVA_SHA256=ff0c3387f47ed2eff9fdf936952573113824fc29de463bb13a3a804cc13d2ae8 ; \
51+
mv "$(ls /tmp/jdk-11*_linux-aarch64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
52+
JAVA_SHA256=3fc0d93f6363d32723c293ba5a9016e8ab27410351ed804020cfe71e87d3bc0a ; \
5353
fi && \
54-
echo "$JAVA_SHA256 */tmp/jdk.tar.gz" | sha256sum -c -; \
55-
mkdir -p "$JAVA_HOME"; \
56-
tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
54+
echo "$JAVA_SHA256 */tmp/jdk.tar.gz" | sha256sum -c -; \
55+
mkdir -p "$JAVA_HOME"; \
56+
tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
5757

58-
## Get a fresh version of OL8 for the final image
58+
## Get a fresh version of Oracle Linux 8 for the final image
5959
FROM oraclelinux:8
6060

6161
# Default to UTF-8 file.encoding
6262
ENV LANG en_US.UTF-8
6363

6464
ENV JAVA_HOME=/usr/java/jdk-11
6565

66-
ENV PATH $JAVA_HOME/bin:$PATH
66+
ENV PATH $JAVA_HOME/bin:$PATH
6767

6868
# Copy the uncompressed Java Runtime from the builder image
6969
COPY --from=builder $JAVA_HOME $JAVA_HOME
7070

7171
RUN set -eux; \
72-
dnf -y update; \
73-
dnf install -y \
72+
dnf -y update; \
73+
dnf install -y \
7474
# JDK assumes freetype is available
75-
freetype fontconfig \
76-
; \
77-
rm -rf /var/cache/dnf; \
78-
ln -sfT "$JAVA_HOME" /usr/java/default; \
79-
ln -sfT "$JAVA_HOME" /usr/java/latest; \
80-
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; \
84-
done; \
75+
freetype fontconfig \
76+
; \
77+
rm -rf /var/cache/dnf; \
78+
ln -sfT "$JAVA_HOME" /usr/java/default; \
79+
ln -sfT "$JAVA_HOME" /usr/java/latest; \
80+
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; \
84+
done; \
8585
# -Xshare:dump will create a CDS archive to improve startup in subsequent runs
86-
java -Xshare:dump;
86+
java -Xshare:dump;
8787

8888
CMD ["jshell"]

OracleJava/11/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
if test "$1" = "8"
88
then
9-
echo "Building Oracle JDK 11 on Oracle Linux 8"
10-
docker build --file Dockerfile.ol8 --tag oracle/jdk:11-ol8 .
9+
echo "Building Oracle JDK 11 on Oracle Linux 8"
10+
docker build --file Dockerfile.ol8 --tag oracle/jdk:11-ol8 .
1111
else
12-
echo "Building Oracle JDK 11 on Oracle Linux 7 slim"
13-
docker build --tag oracle/jdk:11-ol7 .
12+
echo "Building Oracle JDK 11 on Oracle Linux 7 slim"
13+
docker build --tag oracle/jdk:11-ol7 .
1414
fi

OracleJava/17/Dockerfile

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
1+
# Copyright (c) 2020, 2024 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
#
@@ -8,18 +8,17 @@
88
#
99
# REQUIRED FILES TO BUILD THIS IMAGE
1010
# ----------------------------------
11-
# This dockerfile will download a copy of JDK 17 from
12-
# https://download.oracle.com/java/17/latest/jdk-17_linux-<ARCH>_bin.tar.gz
13-
#
14-
# It will use either x64 or aarch64 depending on the target platform
11+
# (1) jdk-17.XX_linux-x64_bin.tar.gz or jdk-17.XX_linux-aarch64_bin.tar.gz
12+
# Download from https://www.oracle.com/java/technologies/downloads
1513
#
1614
# HOW TO BUILD THIS IMAGE
1715
# -----------------------
16+
# Put all downloaded files in the same directory as this Dockerfile
1817
# Run:
1918
# $ docker build -t oracle/jdk:17 .
2019
#
2120
# This command is already scripted in build.sh so you can alternatively run
22-
# $ bash build.sh
21+
# $ bash build.sh
2322
#
2423
# The builder image will be used to uncompress the tar.gz file with the Java Runtime.
2524

@@ -29,59 +28,60 @@ LABEL maintainer="Aurelio Garcia-Ribeyro <[email protected]>"
2928

3029
# Since the files are compressed as tar.gz first dnf install tar. gzip is already in oraclelinux:8
3130
RUN dnf install -y tar
32-
31+
3332
# Default to UTF-8 file.encoding
3433
ENV LANG en_US.UTF-8
3534

3635
# Environment variables for the builder image.
3736
# Required to validate that you are using the correct file
3837

39-
ENV JAVA_URL=https://download.oracle.com/java/17/latest \
40-
JAVA_HOME=/usr/java/jdk-17
38+
ENV JAVA_HOME=/usr/java/jdk-17
4139

4240
##
41+
COPY *.tar.gz /tmp/
4342
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4443
RUN set -eux; \
45-
ARCH="$(uname -m)" && \
46-
# Java uses just x64 in the name of the tarball
44+
ARCH="$(uname -m)" && \
4745
if [ "$ARCH" = "x86_64" ]; \
48-
then ARCH="x64"; \
46+
then \
47+
mv "$(ls /tmp/jdk-17*_linux-x64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
48+
JAVA_SHA256=f7a6fdebeb11840e1f5314bc330feb75b67e52491cf39073dbf3e51e3889ff08 ; \
49+
else \
50+
mv "$(ls /tmp/jdk-17*_linux-aarch64_bin.tar.gz)" /tmp/jdk.tar.gz ; \
51+
JAVA_SHA256=277e0010e7b17583e63827f9537a153ea79cb4b6ca28d523cd8a82f14a24a769 ; \
4952
fi && \
50-
JAVA_PKG="$JAVA_URL"/jdk-17_linux-"${ARCH}"_bin.tar.gz ; \
51-
JAVA_SHA256="$(curl "$JAVA_PKG".sha256)" ; \
52-
curl --output /tmp/jdk.tgz "$JAVA_PKG" && \
53-
echo "$JAVA_SHA256" */tmp/jdk.tgz | sha256sum -c; \
54-
mkdir -p "$JAVA_HOME"; \
55-
tar --extract --file /tmp/jdk.tgz --directory "$JAVA_HOME" --strip-components 1
56-
57-
## Get a fresh version of OL8 for the final image
53+
echo "$JAVA_SHA256 */tmp/jdk.tar.gz" | sha256sum -c -; \
54+
mkdir -p "$JAVA_HOME"; \
55+
tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
56+
57+
## Get a fresh version of Oracle Linux 8 for the final image
5858
FROM oraclelinux:8
5959

6060
# Default to UTF-8 file.encoding
6161
ENV LANG en_US.UTF-8
62-
ENV JAVA_HOME=/usr/java/jdk-17
63-
ENV PATH $JAVA_HOME/bin:$PATH
62+
ENV JAVA_HOME=/usr/java/jdk-17
63+
ENV PATH $JAVA_HOME/bin:$PATH
6464

65-
# If you need the Java Version you can read it from the release file with
65+
# If you need the Java Version you can read it from the release file with
6666
# JAVA_VERSION=$(sed -n '/^JAVA_VERSION="/{s///;s/"//;p;}' "$JAVA_HOME"/release);
6767

6868
# Copy the uncompressed Java Runtime from the builder image
6969
COPY --from=builder $JAVA_HOME $JAVA_HOME
7070

7171
RUN set -eux; \
7272
# Ensure we get the latest OL 8 updates available at build time
73-
dnf -y update; \
74-
# JDK assumes freetype is available
75-
dnf install -y \
76-
freetype fontconfig \
77-
; \
78-
rm -rf /var/cache/dnf; \
79-
ln -sfT "$JAVA_HOME" /usr/java/default; \
80-
ln -sfT "$JAVA_HOME" /usr/java/latest; \
81-
for bin in "$JAVA_HOME/bin/"*; do \
82-
base="$(basename "$bin")"; \
83-
[ ! -e "/usr/bin/$base" ]; \
84-
alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \
85-
done;
86-
87-
CMD ["jshell"]
73+
dnf -y update; \
74+
# JDK assumes freetype is available
75+
dnf install -y \
76+
freetype fontconfig \
77+
; \
78+
rm -rf /var/cache/dnf; \
79+
ln -sfT "$JAVA_HOME" /usr/java/default; \
80+
ln -sfT "$JAVA_HOME" /usr/java/latest; \
81+
for bin in "$JAVA_HOME/bin/"*; do \
82+
base="$(basename "$bin")"; \
83+
[ ! -e "/usr/bin/$base" ]; \
84+
alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \
85+
done;
86+
87+
CMD ["jshell"]

0 commit comments

Comments
 (0)