-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile-windowsservercore-ltsc2022.template
108 lines (96 loc) · 4.18 KB
/
Dockerfile-windowsservercore-ltsc2022.template
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
::HEADER::
FROM mcr.microsoft.com/windows/servercore:ltsc2022
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
ENV HAXETOOLKIT_PATH C:\\HaxeToolkit
ENV NEKOPATH $HAXETOOLKIT_PATH\\neko
ENV HAXEPATH $HAXETOOLKIT_PATH\\haxe
ENV HAXE_STD_PATH $HAXEPATH\\std
ENV HAXELIB_PATH $HAXEPATH\\lib
# PATH isn't actually set in the Docker image, so we have to set it from within the container
RUN $newPath = ('{0};{1};{2}' -f $env:HAXEPATH, $env:NEKOPATH, $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine);
# doing this first to share cache across versions more aggressively
# haxelib.exe needs msvcr120.dll
RUN $url = 'https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x86.exe'; \
Write-Host ('Downloading {0} ...' -f $url); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $url -OutFile 'vcredist_x86.exe'; \
\
Write-Host 'Verifying sha256 (89f4e593ea5541d1c53f983923124f9fd061a1c0c967339109e375c661573c17) ...'; \
if ((Get-FileHash vcredist_x86.exe -Algorithm sha256).Hash -ne '89f4e593ea5541d1c53f983923124f9fd061a1c0c967339109e375c661573c17') { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Installing ...'; \
Start-Process -FilePath "vcredist_x86.exe" -ArgumentList "/Q" -Wait; \
\
Write-Host 'Removing installer...'; \
Remove-Item .\vcredist_x86.exe; \
\
Write-Host 'Complete.';
RUN New-Item -ItemType directory -Path $env:HAXETOOLKIT_PATH;
# install neko, which is a dependency of haxelib
ENV NEKO_VERSION ::NEKO_VERSION::
RUN $url = 'https://github.com/HaxeFoundation/neko/releases/download/::NEKO_TAG::/neko-::NEKO_VERSION::-win64.zip'; \
Write-Host ('Downloading {0} ...' -f $url); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $url -OutFile 'neko.zip'; \
\
Write-Host 'Verifying sha256 (::NEKO_SHA256::) ...'; \
if ((Get-FileHash neko.zip -Algorithm sha256).Hash -ne '::NEKO_SHA256::') { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Expanding ...'; \
New-Item -ItemType directory -Path tmp; \
Expand-Archive -Path neko.zip -DestinationPath tmp; \
if (Test-Path tmp\neko.exe) { Move-Item tmp $env:NEKOPATH } \
else { Move-Item (Resolve-Path tmp\neko* | Select -ExpandProperty Path) $env:NEKOPATH }; \
\
Write-Host 'Removing ...'; \
Remove-Item -Path neko.zip, tmp -Force -Recurse -ErrorAction Ignore; \
\
Write-Host 'Verifying install ...'; \
Write-Host ' neko -version'; neko -version; \
\
Write-Host 'Complete.';
# install haxe
ENV HAXE_VERSION ::HAXE_VERSION::
RUN $url = '::HAXE_FILE::'; \
Write-Host ('Downloading {0} ...' -f $url); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $url -OutFile haxe.zip; \
\
Write-Host 'Verifying sha256 (::HAXE_SHA256::) ...'; \
if ((Get-FileHash haxe.zip -Algorithm sha256).Hash -ne '::HAXE_SHA256::') { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Expanding ...'; \
New-Item -ItemType directory -Path tmp; \
Expand-Archive -Path haxe.zip -DestinationPath tmp; \
if (Test-Path tmp\haxe.exe) { Move-Item tmp $env:HAXEPATH } \
else { Move-Item (Resolve-Path tmp\haxe* | Select -ExpandProperty Path) $env:HAXEPATH }; \
\
Write-Host 'Removing ...'; \
Remove-Item -Path haxe.zip, tmp -Force -Recurse -ErrorAction Ignore; \
\
Write-Host 'Verifying install ...'; \
Write-Host ' haxe -version'; haxe -version; \
Write-Host ' haxelib version'; haxelib version; \
\
Write-Host 'Complete.';
RUN New-Item -ItemType directory -Path $env:HAXELIB_PATH;
# haxelib bundled in haxe 3.2 and below depends on these variables
ENV HOMEDRIVE C:
RUN $newPath = ('{0}\Users\{1}' -f $env:HOMEDRIVE, $env:USERNAME); \
Write-Host ('Updating HOMEPATH: {0}' -f $newPath); \
[Environment]::SetEnvironmentVariable('HOMEPATH', $newPath, [EnvironmentVariableTarget]::Machine);
# Make a request to lib.haxe.org,
# such that Windows fetches the certs, which can then used by haxelib.
RUN (New-Object System.Net.WebClient).DownloadString('https://lib.haxe.org/p/hxcpp/4.2.1/download/') >$null
CMD ["haxe"]