mirror of https://github.com/jenkinsci/docker.git
chore(linux): Switch from Temurin base images to Temurin JDK binaries (#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.
https://github.com/jenkinsci/docker/pull/1847#discussion_r1569091139
* 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 <mark.earl.waite@gmail.com>
This commit is contained in:
parent
7874b8a495
commit
d924eaa913
|
|
@ -1,6 +1,20 @@
|
|||
ARG JAVA_VERSION=11.0.22_7
|
||||
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy as jre-build
|
||||
FROM almalinux:8.9 as jre-build
|
||||
|
||||
ARG JAVA_VERSION=11.0.22_7
|
||||
|
||||
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)
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
FROM registry.access.redhat.com/ubi9/ubi:9.3-1610 as jre-build
|
||||
|
||||
ARG JAVA_VERSION=21.0.2_13
|
||||
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
|
||||
|
|
@ -13,7 +28,7 @@ RUN jlink \
|
|||
--compress zip-6 \
|
||||
--output /javaruntime
|
||||
|
||||
FROM registry.access.redhat.com/ubi9/ubi:9.3-1552
|
||||
FROM registry.access.redhat.com/ubi9/ubi:9.3-1610 as controller
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Check if at least one argument was passed to the script
|
||||
# If one argument was passed and JAVA_VERSION is set, assign the argument to OS
|
||||
# If two arguments were passed, assign them to JAVA_VERSION and OS respectively
|
||||
# If not, check if JAVA_VERSION and OS are already set. If they're not set, exit the script with an error message
|
||||
if [ $# -eq 1 ] && [ -n "$JAVA_VERSION" ]; then
|
||||
OS=$1
|
||||
elif [ $# -eq 2 ]; then
|
||||
JAVA_VERSION=$1
|
||||
OS=$2
|
||||
elif [ -z "$JAVA_VERSION" ] && [ -z "$OS" ]; then
|
||||
echo "Error: No Java version and OS specified. Please set the JAVA_VERSION and OS environment variables or pass them as arguments." >&2
|
||||
exit 1
|
||||
elif [ -z "$JAVA_VERSION" ]; then
|
||||
echo "Error: No Java version specified. Please set the JAVA_VERSION environment variable or pass it as an argument." >&2
|
||||
exit 1
|
||||
elif [ -z "$OS" ]; then
|
||||
OS=$1
|
||||
if [ -z "$OS" ]; then
|
||||
echo "Error: No OS specified. Please set the OS environment variable or pass it as an argument." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if jq and curl are installed
|
||||
# If they are not installed, exit the script with an error message
|
||||
if ! command -v jq >/dev/null 2>&1 || ! command -v curl >/dev/null 2>&1; then
|
||||
echo "jq and curl are required but not installed. Exiting with status 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Replace underscores with plus signs in JAVA_VERSION
|
||||
ARCHIVE_DIRECTORY=$(echo "$JAVA_VERSION" | tr '_' '+')
|
||||
|
||||
# URL encode ARCHIVE_DIRECTORY
|
||||
ENCODED_ARCHIVE_DIRECTORY=$(echo "$ARCHIVE_DIRECTORY" | xargs -I {} printf %s {} | jq "@uri" -jRr)
|
||||
|
||||
# Convert the architecture name to the format used by the Adoptium API
|
||||
CONVERTED_ARCH=$(uname -m | sed -e 's/x86_64/x64/' -e 's/armv7l/arm/')
|
||||
|
||||
# Determine the OS type for the URL
|
||||
OS_TYPE="linux"
|
||||
if [ "$OS" = "alpine" ]; then
|
||||
OS_TYPE="alpine-linux"
|
||||
fi
|
||||
|
||||
# Fetch the download URL from the Adoptium API
|
||||
URL="https://api.adoptium.net/v3/binary/version/jdk-${ENCODED_ARCHIVE_DIRECTORY}/${OS_TYPE}/${CONVERTED_ARCH}/jdk/hotspot/normal/eclipse?project=jdk"
|
||||
|
||||
if ! RESPONSE=$(curl -fsI "$URL"); then
|
||||
echo "Error: Failed to fetch the URL. Exiting with status 1." >&2
|
||||
echo "Response: $RESPONSE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract the redirect URL from the HTTP response
|
||||
REDIRECTED_URL=$(echo "$RESPONSE" | grep Location | awk '{print $2}' | tr -d '\r')
|
||||
|
||||
# If no redirect URL was found, exit the script with an error message
|
||||
if [ -z "$REDIRECTED_URL" ]; then
|
||||
echo "Error: No redirect URL found. Exiting with status 1." >&2
|
||||
echo "Response: $RESPONSE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use curl to check if the URL is reachable
|
||||
# If the URL is reachable, print the URL
|
||||
# If the URL is not reachable, print an error message and exit the script with status 1
|
||||
if ! curl -v -fs "$REDIRECTED_URL" >/dev/null 2>&1; then
|
||||
echo "${REDIRECTED_URL}" is not reachable. >&2
|
||||
exit 1
|
||||
else
|
||||
echo "$REDIRECTED_URL"
|
||||
fi
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
set -x
|
||||
# Check if curl and tar are installed
|
||||
if ! command -v curl >/dev/null 2>&1 || ! command -v tar >/dev/null 2>&1 ; then
|
||||
echo "curl and tar are required but not installed. Exiting with status 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set the OS to "standard" by default
|
||||
OS="standard"
|
||||
|
||||
# If a second argument is provided, use it as the OS
|
||||
if [ $# -eq 1 ]; then
|
||||
OS=$1
|
||||
fi
|
||||
|
||||
# Call jdk-download-url.sh with JAVA_VERSION and OS as arguments
|
||||
# The two scripts should be in the same directory.
|
||||
# That's why we're trying to find the directory of the current script and use it to call the other script.
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" || exit; pwd)
|
||||
if ! DOWNLOAD_URL=$("${SCRIPT_DIR}"/jdk-download-url.sh "${JAVA_VERSION}" "${OS}"); then
|
||||
echo "Error: Failed to fetch the URL. Exiting with status 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use curl to download the JDK archive from the URL
|
||||
if ! curl --silent --location --output /tmp/jdk.tar.gz "${DOWNLOAD_URL}"; then
|
||||
echo "Error: Failed to download the JDK archive. Exiting with status 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract the archive to the /opt/ directory
|
||||
if ! tar -xzf /tmp/jdk.tar.gz -C /opt/; then
|
||||
echo "Error: Failed to extract the JDK archive. Exiting with status 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the name of the extracted directory
|
||||
EXTRACTED_DIR=$(tar -tzf /tmp/jdk.tar.gz | head -n 1 | cut -f1 -d"/")
|
||||
|
||||
# Rename the extracted directory to /opt/jdk-${JAVA_VERSION}
|
||||
if ! mv "/opt/${EXTRACTED_DIR}" "/opt/jdk-${JAVA_VERSION}"; then
|
||||
echo "Error: Failed to rename the extracted directory. Exiting with status 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove the downloaded archive
|
||||
if ! rm -f /tmp/jdk.tar.gz; then
|
||||
echo "Error: Failed to remove the downloaded archive. Exiting with status 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Reference in New Issue