-
Notifications
You must be signed in to change notification settings - Fork 476
/
Dockerfile
43 lines (38 loc) · 1.66 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM microsoft/windowsservercore:ltsc2016
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV JAVA_HOME C:\\openjdk-12
RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
# Nano Server does not have "[Environment]::SetEnvironmentVariable()"
setx /M PATH $newPath
# http://jdk.java.net/
ENV JAVA_VERSION 12-ea+19
ENV JAVA_URL https://download.java.net/java/early_access/jdk12/19/GPL/openjdk-12-ea+19_windows-x64_bin.zip
ENV JAVA_SHA256 6053dd7893539141545a82fdf0b948dd1723bed6c1011ec3fdeaac35423f6b29
RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \
Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_SHA256); \
if ((Get-FileHash openjdk.zip -Algorithm sha256).Hash -ne $env:JAVA_SHA256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Expanding ...'; \
New-Item -ItemType Directory -Path C:\temp | Out-Null; \
Expand-Archive openjdk.zip -DestinationPath C:\temp; \
Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \
Remove-Item C:\temp; \
\
Write-Host 'Verifying install ...'; \
Write-Host ' java --version'; java --version; \
Write-Host ' javac --version'; javac --version; \
\
Write-Host 'Removing ...'; \
Remove-Item openjdk.zip -Force; \
\
Write-Host 'Complete.'
# https://docs.oracle.com/javase/10/tools/jshell.htm
# https://en.wikipedia.org/wiki/JShell
CMD ["jshell"]