-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.win
58 lines (51 loc) · 2.46 KB
/
Dockerfile.win
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
FROM haxe:4.0.5-windowsservercore-1809
SHELL ["powershell", "-command"]
ENV HASHLINK_BIN C:\\hashlink
ENV HASHLINK C:\\hashlink\\include
# 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:HASHLINK_BIN, $env:HASHLINK, $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); \
$newInclude = ('{0}' -f $env:MSVC_INCLUDE); \
Write-Host ('Updating INCLUDE: {0}' -f $newInclude); \
[Environment]::SetEnvironmentVariable('INCLUDE', $newInclude, [EnvironmentVariableTarget]::Machine); \
$newLib = ('{0}' -f $env:MSVC_LIB); \
Write-Host ('Updating LIB: {0}' -f $newLib); \
[Environment]::SetEnvironmentVariable('LIB', $newLib, [EnvironmentVariableTarget]::Machine); \
$newLibPath = ('{0}' -f $env:MSVC_LIBPATH); \
Write-Host ('Updating LIBPATH: {0}' -f $newLibPath); \
[Environment]::SetEnvironmentVariable('LIBPATH', $newLibPath, [EnvironmentVariableTarget]::Machine);
# doing this first to share cache across versions more aggressively
RUN Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression
RUN choco install vcbuildtools -y
RUN refreshenv
RUN Write-Host 'Configuring environment'; \
pushd 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' ; \
cmd /c 'vcvarsall.bat amd64&set' | foreach { \
if ($_ -match '=') { \
$v = $_.split('='); \
[Environment]::SetEnvironmentVariable($v[0], $v[1], [EnvironmentVariableTarget]::Machine); \
} \
} ; \
popd
# install hashlink
ENV HL_VERSION 1.10
RUN $url = 'https://github.com/HaxeFoundation/hashlink/releases/download/1.11/hl-1.11.0-win.zip'; \
Write-Host ('Downloading {0} ...' -f $url); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $url -OutFile hashlink.zip; \
\
Write-Host 'Expanding ...'; \
New-Item -ItemType directory -Path tmp; \
Expand-Archive -Path hashlink.zip -DestinationPath tmp; \
if (Test-Path tmp\hl.exe) { Move-Item tmp $env:HASHLINK_BIN } \
else { Move-Item (Resolve-Path tmp\hl* | Select -ExpandProperty Path) $env:HASHLINK_BIN }; \
\
Write-Host 'Removing ...'; \
Remove-Item -Path hashlink.zip, tmp -Force -Recurse -ErrorAction Ignore; \
\
Write-Host 'Verifying install ...'; \
Write-Host ' hl'; hl; \
\
Write-Host 'Complete.';
CMD ["ping", "-t", "127.0.0.1"]