Dockerfile
· 990 B · Docker
Raw
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"]
| 1 | FROM mcr.microsoft.com/windows/servercore:ltsc2022 |
| 2 | |
| 3 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 4 | |
| 5 | ENV JAVA_HOME "C:\Program Files\AdoptOpenJDK\jre-17.0.0.20-hotspot" |
| 6 | RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ |
| 7 | Write-Host ('Updating PATH: {0}' -f $newPath); \ |
| 8 | setx /M PATH $newPath; \ |
| 9 | Write-Host 'Complete.' |
| 10 | |
| 11 | ENV JAVA_VERSION 17.0.0.20 |
| 12 | 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 |
| 13 | |
| 14 | RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ |
| 15 | (new-object System.Net.WebClient).Downloadfile("$env:JAVA_URL", 'C:\jre.msi'); \ |
| 16 | Start-Process 'C:\jre.msi' '/qn /norestart /L*V "C:\jre.msi.log"' -PassThru | Wait-Process; \ |
| 17 | Remove-Item -Path 'C:\jre.msi'; \ |
| 18 | \ |
| 19 | Write-Host 'Verifying install ...'; \ |
| 20 | Write-Host ' java --version'; java --version; \ |
| 21 | \ |
| 22 | Write-Host 'Complete.' |
| 23 | |
| 24 | CMD ["powershell"] |
| 25 |