Skip to content

Commit 58495af

Browse files
committed
Add Windows 1809 for Swift 5.10
1 parent ea03579 commit 58495af

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

5.10/windows/1809/Dockerfile

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
FROM mcr.microsoft.com/windows/servercore:1809 AS windows
2+
3+
LABEL maintainer="Swift Infrastructure <[email protected]>"
4+
LABEL description="Docker Container for the Swift programming language"
5+
6+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
7+
8+
ENV PYTHONIOENCODING UTF-8
9+
10+
# Install Git.
11+
# See: git-[version]-[bit].exe /SAVEINF=git.inf and /?
12+
ARG GIT=https://github.com/git-for-windows/git/releases/download/v2.42.0.windows.2/Git-2.42.0.2-64-bit.exe
13+
ARG GIT_SHA256=BD9B41641A258FD16D99BEECEC66132160331D685DFB4C714CEA2BCC78D63BDB
14+
RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:GIT}); \
15+
Invoke-WebRequest -Uri ${env:GIT} -OutFile git.exe; \
16+
Write-Host '✓'; \
17+
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${env:GIT_SHA256}); \
18+
$Hash = Get-FileHash git.exe -Algorithm sha256; \
19+
if ($Hash.Hash -eq ${env:GIT_SHA256}) { \
20+
Write-Host '✓'; \
21+
} else { \
22+
Write-Host ('✘ ({0})' -f $Hash.Hash); \
23+
exit 1; \
24+
} \
25+
Write-Host -NoNewLine 'Installing git ... '; \
26+
$Process = \
27+
Start-Process git.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
28+
'/SP-', \
29+
'/VERYSILENT', \
30+
'/SUPPRESSMSGBOXES', \
31+
'/NOCANCEL', \
32+
'/NORESTART', \
33+
'/CLOSEAPPLICATIONS', \
34+
'/FORCECLOSEAPPLICATIONS', \
35+
'/NOICONS', \
36+
'/COMPONENTS="gitlfs"', \
37+
'/EditorOption=VIM', \
38+
'/PathOption=Cmd', \
39+
'/SSHOption=OpenSSH', \
40+
'/CURLOption=WinSSL', \
41+
'/UseCredentialManager=Enabled', \
42+
'/EnableSymlinks=Enabled', \
43+
'/EnableFSMonitor=Enabled' \
44+
); \
45+
if ($Process.ExitCode -eq 0) { \
46+
Write-Host '✓'; \
47+
} else { \
48+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
49+
exit 1; \
50+
} \
51+
Remove-Item -Force git.exe; \
52+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
53+
54+
# Install Python
55+
ARG PY39=https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe
56+
ARG PY39_SHA256=FB3D0466F3754752CA7FD839A09FFE53375FF2C981279FD4BC23A005458F7F5D
57+
RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:PY39}); \
58+
Invoke-WebRequest -Uri ${env:PY39} -OutFile python-3.9.13-amd64.exe; \
59+
Write-Host '✓'; \
60+
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${env:PY39_SHA256});\
61+
$Hash = Get-FileHash python-3.9.13-amd64.exe -Algorithm sha256; \
62+
if ($Hash.Hash -eq ${env:PY39_SHA256}) { \
63+
Write-Host '✓'; \
64+
} else { \
65+
Write-Host ('✘ ({0})' -f $Hash.Hash); \
66+
exit 1; \
67+
} \
68+
Write-Host -NoNewLine 'Installing Python ... '; \
69+
$Process = \
70+
Start-Process python-3.9.13-amd64.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
71+
'AssociateFiles=0', \
72+
'Include_doc=0', \
73+
'Include_debug=0', \
74+
'Include_lib=1', \
75+
'Include_tcltk=0', \
76+
'Include_test=0', \
77+
'InstallAllUsers=1', \
78+
'InstallLauncherAllUsers=0', \
79+
'PrependPath=1', \
80+
'/quiet' \
81+
); \
82+
if ($Process.ExitCode -eq 0) { \
83+
Write-Host '✓'; \
84+
} else { \
85+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
86+
exit 1; \
87+
} \
88+
Remove-Item -Force python-3.9.13-amd64.exe; \
89+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
90+
91+
# Install Visual Studio Build Tools
92+
ARG VSB=https://aka.ms/vs/17/release/vs_buildtools.exe
93+
ARG VSB_SHA256=D4E08524CB0E5BD061A24F507928D1CFB91DCE192C5E12ED964B8343FC4CDEDD
94+
RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:VSB}); \
95+
Invoke-WebRequest -Uri ${env:VSB} -OutFile vs_buildtools.exe; \
96+
Write-Host '✓'; \
97+
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${env:VSB_SHA256}); \
98+
$Hash = Get-FileHash vs_buildtools.exe -Algorithm sha256; \
99+
if ($Hash.Hash -eq ${env:VSB_SHA256}) { \
100+
Write-Host '✓'; \
101+
} else { \
102+
Write-Host ('✘ ({0})' -f $Hash.Hash); \
103+
} \
104+
Write-Host -NoNewLine 'Installing Visual Studio Build Tools ... '; \
105+
$Process = \
106+
Start-Process vs_buildtools.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
107+
'--quiet', \
108+
'--wait', \
109+
'--norestart', \
110+
'--nocache', \
111+
'--add', 'Microsoft.VisualStudio.Component.Windows11SDK.22000', \
112+
'--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' \
113+
); \
114+
if ($Process.ExitCode -eq 0 -or $Process.ExitCode -eq 3010) { \
115+
Write-Host '✓'; \
116+
} else { \
117+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
118+
exit 1; \
119+
} \
120+
Remove-Item -Force vs_buildtools.exe; \
121+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
122+
123+
# Install Swift toolchain.
124+
ARG SWIFT=https://download.swift.org/swift-5.10-release/windows10/swift-5.10-RELEASE/swift-5.10-RELEASE-windows10.exe
125+
ARG SWIFT_SHA256=A0E2B32DFB56FCB83D4FEC1D1FF4B43B4B0986EDE4C065FF52F336EA9AA49322
126+
RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:SWIFT}); \
127+
Invoke-WebRequest -Uri ${env:SWIFT} -OutFile installer.exe; \
128+
Write-Host '✓'; \
129+
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${env:SWIFT_SHA256}); \
130+
$Hash = Get-FileHash installer.exe -Algorithm sha256; \
131+
if ($Hash.Hash -eq ${env:SWIFT_SHA256}) { \
132+
Write-Host '✓'; \
133+
} else { \
134+
Write-Host ('✘ ({0})' -f $Hash.Hash); \
135+
exit 1; \
136+
} \
137+
Write-Host -NoNewLine 'Installing Swift ... '; \
138+
$Process = \
139+
Start-Process installer.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
140+
'/quiet', \
141+
'/norestart' \
142+
); \
143+
if ($Process.ExitCode -eq 0) { \
144+
Write-Host '✓'; \
145+
} else { \
146+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
147+
exit 1; \
148+
} \
149+
Remove-Item -Force installer.exe; \
150+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
151+
152+
# Default to powershell
153+
# FIXME: we need to grant ContainerUser the SeCreateSymbolicLinkPrivilege
154+
# privilege so that it can create symbolic links.
155+
# USER ContainerUser
156+
CMD ["powershell.exe", "-nologo", "-ExecutionPolicy", "Bypass"]

0 commit comments

Comments
 (0)