-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile-nanoserver.template
84 lines (74 loc) · 3 KB
/
Dockerfile-nanoserver.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
::HEADER::
FROM microsoft/nanoserver
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); \
# Nano Server does not have "[Environment]::SetEnvironmentVariable()"
setx /M PATH $newPath;
# doing this first to share cache across versions more aggressively
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::-win.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 '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); \
setx /M HOMEPATH $newPath;
CMD ["haxe"]