FROM mcr.microsoft.com/windows/servercore:ltsc2022 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JAVA_HOME "C:\Program Files\AdoptOpenJDK\jre-17.0.0.20-hotspot" RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ Write-Host ('Updating PATH: {0}' -f $newPath); \ setx /M PATH $newPath; \ Write-Host 'Complete.' ENV JAVA_VERSION 17.0.0.20 ENV JAVA_URL https://github.com/AdoptOpenJDK/openjdk17-binaries/releases/download/jdk-2021-05-07-13-31/OpenJDK-jre_x64_windows_hotspot_2021-05-06-23-30.msi RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ (new-object System.Net.WebClient).Downloadfile("$env:JAVA_URL", 'C:\jre.msi'); \ Start-Process 'C:\jre.msi' '/qn /norestart /L*V "C:\jre.msi.log"' -PassThru | Wait-Process; \ Remove-Item -Path 'C:\jre.msi'; \ \ Write-Host 'Verifying install ...'; \ Write-Host ' java --version'; java --version; \ \ Write-Host 'Complete.' CMD ["powershell"]