Skip to content

Commit

Permalink
chore(linux): Switch from Temurin base images to Temurin JDK binaries (
Browse files Browse the repository at this point in the history
…jenkinsci#1847)

* chore(debian): Switch from Temurin base images to Temurin JDK binaries

* chore(debian): Switch from Temurin base images to Temurin JDK binaries

* chore(redhat): Switch from Temurin base images to Temurin JDK binaries

* chore(redhat): Switch from Temurin base images to Temurin JDK binaries

* chore(alma): Switch from Temurin base images to Temurin JDK binaries

* chore(alpine): Switch from Temurin base images to Temurin JDK binaries

* chore(debian): Switch from Temurin base images to Temurin JDK binaries

* chore(ubi9): Switch from Temurin base images to Temurin JDK binaries

* chore(alpine): Switch from Temurin base images to Temurin JDK binaries

* chore(debian): Switch from Temurin base images to Temurin JDK binaries

* chore(debian-slim): Switch from Temurin base images to Temurin JDK binaries

* chore(ubi9): Switch from Temurin base images to Temurin JDK binaries

* fix(docker): Not really needed, just for consistency.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Following Damien's recommendations.

* Make shell script executable

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Hadolint shellcheck.

* fix(docker): Following Damien's recommendations.

* feat(temurin): Computes the GitHub download URL thanks to the Adoptium API.

* feat(temurin): Computes the GitHub download URL thanks to the Adoptium API.

* fix(temurin): Uses two scripts to find the right JDK download URL.

One for the URL gathering, and one for the JDK installation.

* fix(temurin): Better error handling.

* fix(temurin): ShellCheck suggestions.

* fix(temurin): ShellCheck suggestions.

* fix(temurin): ShellCheck suggestions.

* fix(temurin): ShellCheck suggestions.

* fix(temurin): ShellCheck suggestions.

* fix(temurin): Try to add '--allowerasing' to command line to replace conflicting packages

 or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
              4.242 Error:
              4.242  Problem: problem with installed package curl-minimal-7.76.1-26.el9_3.3.x86_64
              4.242   - package curl-minimal-7.76.1-26.el9_3.3.x86_64 from @System conflicts with curl provided by curl-7.76.1-26.el9_3.3.x86_64 from ubi-9-baseos-rpms
              4.242   - package curl-minimal-7.76.1-26.el9_3.3.x86_64 from ubi-9-baseos-rpms conflicts with curl provided by curl-7.76.1-26.el9_3.3.x86_64 from ubi-9-baseos-rpms
              4.242   - conflicting requests

* fix(temurin): Try to add '--allowerasing' to command line to replace conflicting packages

 or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
              4.242 Error:
              4.242  Problem: problem with installed package curl-minimal-7.76.1-26.el9_3.3.x86_64
              4.242   - package curl-minimal-7.76.1-26.el9_3.3.x86_64 from @System conflicts with curl provided by curl-7.76.1-26.el9_3.3.x86_64 from ubi-9-baseos-rpms
              4.242   - package curl-minimal-7.76.1-26.el9_3.3.x86_64 from ubi-9-baseos-rpms conflicts with curl provided by curl-7.76.1-26.el9_3.3.x86_64 from ubi-9-baseos-rpms
              4.242   - conflicting requests

* Make shell script executable

* fix(temurin): Better handling of 307 HTTP Code.

* fix(docker): One less layer.

Thanks Damien for the tip.

* fix(docker): testing mv is not so clever/necessary.

* fix(docker): Adoptium API bug workaround.

* fix(temurin): ShellCheck suggestions.

* fix(temurin): ShellCheck suggestions.

* fix(temurin): Message.

* fix(temurin): Message.

* fix(temurin): JAVA_VERSION is only used in the first stage.

* fix(temurin): Removed debug RUN instruction.

* fix(temurin): Following Damien's remark.

jenkinsci#1847 (comment)

* fix(temurin): Factorize shell scripts.

* fix(temurin): Factorize shell scripts.

* fix(temurin): What was I thinking?

* fix(temurin): URL compute simplification.

* Update curl/tar existence check comment to match code

Not checking for the existence of "mv"

* Use the "z" argument to read tar.gz contents

Don't rely on the tar command to guess the type of the file when we know
the type of the file already and used that file type in the earlier
invocation of tar.

---------

Co-authored-by: Mark Waite <[email protected]>
  • Loading branch information
gounthar and MarkEWaite committed Apr 20, 2024
1 parent 7874b8a commit d924eaa
Show file tree
Hide file tree
Showing 15 changed files with 359 additions and 26 deletions.
18 changes: 16 additions & 2 deletions 11/almalinux/almalinux8/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
FROM almalinux:8.9 as jre-build

ARG JAVA_VERSION=11.0.22_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN dnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y \
ca-certificates \
curl \
jq \
&& dnf clean all \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH
# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
# while still saving space (approx 200mb from the full distribution)
Expand All @@ -13,7 +27,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM almalinux:8.9
FROM almalinux:8.9 AS controller

ENV LANG C.UTF-8

Expand Down
19 changes: 17 additions & 2 deletions 11/alpine/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
ARG ALPINE_TAG=3.19.1

FROM alpine:"${ALPINE_TAG}" AS jre-build

ARG JAVA_VERSION=11.0.22_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-alpine AS jre-build

SHELL ["/bin/ash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh
RUN apk add --no-cache \
ca-certificates \
curl \
jq \
&& rm -fr /var/cache/apk/* \
&& /usr/bin/jdk-download.sh alpine

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +29,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM alpine:"${ALPINE_TAG}" AS build
FROM alpine:"${ALPINE_TAG}" AS controller

RUN apk add --no-cache \
bash \
Expand Down
21 changes: 19 additions & 2 deletions 11/debian/bookworm-slim/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
ARG BOOKWORM_TAG=20240408

FROM debian:bookworm-"${BOOKWORM_TAG}"-slim as jre-build

ARG JAVA_VERSION=11.0.22_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +31,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM debian:bookworm-"${BOOKWORM_TAG}"-slim
FROM debian:bookworm-"${BOOKWORM_TAG}"-slim AS controller

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down
21 changes: 19 additions & 2 deletions 11/debian/bookworm/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
ARG BOOKWORM_TAG=20240408

FROM debian:bookworm-"${BOOKWORM_TAG}" as jre-build

ARG JAVA_VERSION=11.0.22_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +31,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM debian:bookworm-"${BOOKWORM_TAG}"
FROM debian:bookworm-"${BOOKWORM_TAG}" AS controller

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down
19 changes: 17 additions & 2 deletions 11/rhel/ubi8/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
FROM registry.access.redhat.com/ubi8/ubi:8.9-1160 as jre-build

ARG JAVA_VERSION=11.0.22_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN dnf install --disableplugin=subscription-manager --setopt=install_weak_deps=0 --setopt=tsflags=nodocs -y \
ca-certificates \
curl \
jq \
&& dnf clean --disableplugin=subscription-manager all \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -13,7 +28,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM registry.access.redhat.com/ubi8/ubi:8.9-1160
FROM registry.access.redhat.com/ubi8/ubi:8.9-1160 AS controller

ENV LANG C.UTF-8

Expand Down
20 changes: 18 additions & 2 deletions 17/alpine/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
ARG ALPINE_TAG=3.19.1

FROM alpine:"${ALPINE_TAG}" AS jre-build

ARG JAVA_VERSION=17.0.10_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-alpine AS jre-build

SHELL ["/bin/ash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN apk add --no-cache \
ca-certificates \
jq \
curl \
&& rm -fr /var/cache/apk/* \
&& /usr/bin/jdk-download.sh alpine

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +30,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM alpine:"${ALPINE_TAG}" AS build
FROM alpine:"${ALPINE_TAG}" AS controller

RUN apk add --no-cache \
bash \
Expand Down
21 changes: 19 additions & 2 deletions 17/debian/bookworm-slim/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
ARG BOOKWORM_TAG=20240408

FROM debian:bookworm-"${BOOKWORM_TAG}"-slim as jre-build

ARG JAVA_VERSION=17.0.10_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +31,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM debian:bookworm-"${BOOKWORM_TAG}"-slim
FROM debian:bookworm-"${BOOKWORM_TAG}"-slim AS controller

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down
21 changes: 19 additions & 2 deletions 17/debian/bookworm/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
ARG BOOKWORM_TAG=20240408

FROM debian:bookworm-"${BOOKWORM_TAG}" as jre-build

ARG JAVA_VERSION=17.0.10_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +31,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM debian:bookworm-"${BOOKWORM_TAG}"
FROM debian:bookworm-"${BOOKWORM_TAG}" AS controller

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down
19 changes: 17 additions & 2 deletions 17/rhel/ubi9/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
FROM registry.access.redhat.com/ubi9/ubi:9.3-1610 as jre-build

ARG JAVA_VERSION=17.0.10_7
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-ubi9-minimal as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN dnf install --disableplugin=subscription-manager --setopt=install_weak_deps=0 --setopt=tsflags=nodocs --allowerasing -y \
ca-certificates \
curl \
jq \
&& dnf clean --disableplugin=subscription-manager all \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -13,7 +28,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM registry.access.redhat.com/ubi9/ubi:9.3-1610
FROM registry.access.redhat.com/ubi9/ubi:9.3-1610 AS controller

ENV LANG C.UTF-8

Expand Down
19 changes: 17 additions & 2 deletions 21/alpine/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
ARG ALPINE_TAG=3.19.1

FROM alpine:"${ALPINE_TAG}" AS jre-build

ARG JAVA_VERSION=21.0.2_13
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-alpine AS jre-build

SHELL ["/bin/ash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh
RUN apk add --no-cache \
ca-certificates \
curl \
jq \
&& rm -fr /var/cache/apk/* \
&& /usr/bin/jdk-download.sh alpine

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +29,7 @@ RUN jlink \
--compress zip-6 \
--output /javaruntime

FROM alpine:"${ALPINE_TAG}" AS build
FROM alpine:"${ALPINE_TAG}" AS controller

RUN apk add --no-cache \
bash \
Expand Down
21 changes: 19 additions & 2 deletions 21/debian/bookworm-slim/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
ARG BOOKWORM_TAG=20240408

FROM debian:bookworm-"${BOOKWORM_TAG}"-slim as jre-build

ARG JAVA_VERSION=21.0.2_13
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +31,7 @@ RUN jlink \
--compress zip-6 \
--output /javaruntime

FROM debian:bookworm-"${BOOKWORM_TAG}"-slim
FROM debian:bookworm-"${BOOKWORM_TAG}"-slim AS controller

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down
21 changes: 19 additions & 2 deletions 21/debian/bookworm/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
ARG BOOKWORM_TAG=20240408

FROM debian:bookworm-"${BOOKWORM_TAG}" as jre-build

ARG JAVA_VERSION=21.0.2_13
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY jdk-download-url.sh /usr/bin/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/jdk-download.sh

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& /usr/bin/jdk-download.sh

ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -14,7 +31,7 @@ RUN jlink \
--compress zip-6 \
--output /javaruntime

FROM debian:bookworm-"${BOOKWORM_TAG}"
FROM debian:bookworm-"${BOOKWORM_TAG}" AS controller

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down
Loading

0 comments on commit d924eaa

Please sign in to comment.