Skip to content

Commit

Permalink
chore(windows): Switch from Temurin base images to Temurin JDK binari…
Browse files Browse the repository at this point in the history
…es (jenkinsci#1848)

* 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.

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

* 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.

* fix(docker): Builds at last.

* Update windows/windowsservercore/hotspot/Dockerfile

Co-authored-by: Mark Waite <[email protected]>

---------

Co-authored-by: Mark Waite <[email protected]>
  • Loading branch information
gounthar and MarkEWaite committed Apr 22, 2024
1 parent 5e6dee3 commit 2d23c1d
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions windows/windowsservercore/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,45 @@
ARG JAVA_VERSION=17.0.10_7
ARG WINDOWS_VERSION=ltsc2019
ARG TOOLS_WINDOWS_VERSION=1809
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-windowsservercore-"${TOOLS_WINDOWS_VERSION}" AS jdk-core

FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION}"
FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION}" AS jre-build

# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ARG JAVA_VERSION

RUN New-Item -ItemType Directory -Path C:\temp | Out-Null ; `
$javaMajorVersion = $env:JAVA_VERSION.substring(0,2) ; `
$msiUrl = 'https://api.adoptium.net/v3/installer/version/jdk-{0}/windows/x64/jdk/hotspot/normal/eclipse?project=jdk' -f $env:JAVA_VERSION.Replace('_', '%2B') ; `
Invoke-WebRequest $msiUrl -OutFile 'C:\temp\jdk.msi' ; `
$proc = Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i', 'C:\temp\jdk.msi', '/L*V', 'C:\temp\OpenJDK.log', '/quiet', 'ADDLOCAL=FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome', "INSTALLDIR=C:\openjdk-${javaMajorVersion}" -Wait -Passthru ; `
$proc.WaitForExit() ; `
Remove-Item -Path C:\temp -Recurse | Out-Null

RUN Write-Host 'javac --version' ; javac --version ; `
Write-Host 'java --version' ; java --version

RUN $version = (jlink --version) ; `
$stripJavaDebugFlags = '--strip-java-debug-attributes' ; `
# jlink version 11 has less features than JDK17+
if ($version.StartsWith('11')) { `
$stripJavaDebugFlags = '--strip-debug' ; `
} `
& jlink `
--add-modules ALL-MODULE-PATH `
$stripJavaDebugFlags `
--no-man-pages `
--no-header-files `
--compress=2 `
--output /javaruntime

FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION}" AS controller

ARG JAVA_HOME="C:/openjdk-17"
ENV JAVA_HOME=${JAVA_HOME}

COPY --from=jdk-core $JAVA_HOME $JAVA_HOME
COPY --from=jre-build /javaruntime $JAVA_HOME

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

Expand Down

0 comments on commit 2d23c1d

Please sign in to comment.