Skip to content

Commit 92f2edc

Browse files
authored
Windows: add 6.0 nightly snapshots for Windows (#376)
Introduce docker images for LTSC2022 Windows images with the 6.0 Swift toolchain.
1 parent d6fe762 commit 92f2edc

File tree

2 files changed

+306
-0
lines changed

2 files changed

+306
-0
lines changed

nightly-6.0/windows/1809/Dockerfile

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
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+
ENV PYTHONUTF8=1
10+
11+
# Enable Developer Mode.
12+
RUN reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
13+
# Enable Long Paths
14+
RUN reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /t REG_DWORD /f /v "LongPathsEnabled" /d "1"
15+
16+
# Install Git.
17+
# See: git-[version]-[bit].exe /SAVEINF=git.inf and /?
18+
ARG GIT=https://github.com/git-for-windows/git/releases/download/v2.42.0.windows.2/Git-2.42.0.2-64-bit.exe
19+
ARG GIT_SHA256=BD9B41641A258FD16D99BEECEC66132160331D685DFB4C714CEA2BCC78D63BDB
20+
RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:GIT}); \
21+
Invoke-WebRequest -Uri ${env:GIT} -OutFile git.exe; \
22+
Write-Host '✓'; \
23+
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${env:GIT_SHA256}); \
24+
$Hash = Get-FileHash git.exe -Algorithm sha256; \
25+
if ($Hash.Hash -eq ${env:GIT_SHA256}) { \
26+
Write-Host '✓'; \
27+
} else { \
28+
Write-Host ('✘ ({0})' -f $Hash.Hash); \
29+
exit 1; \
30+
} \
31+
Write-Host -NoNewLine 'Installing git ... '; \
32+
$Process = \
33+
Start-Process git.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
34+
'/SP-', \
35+
'/VERYSILENT', \
36+
'/SUPPRESSMSGBOXES', \
37+
'/NOCANCEL', \
38+
'/NORESTART', \
39+
'/CLOSEAPPLICATIONS', \
40+
'/FORCECLOSEAPPLICATIONS', \
41+
'/NOICONS', \
42+
'/COMPONENTS="gitlfs"', \
43+
'/EditorOption=VIM', \
44+
'/PathOption=Cmd', \
45+
'/SSHOption=OpenSSH', \
46+
'/CURLOption=WinSSL', \
47+
'/UseCredentialManager=Enabled', \
48+
'/EnableSymlinks=Enabled', \
49+
'/EnableFSMonitor=Enabled' \
50+
); \
51+
if ($Process.ExitCode -eq 0) { \
52+
Write-Host '✓'; \
53+
} else { \
54+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
55+
exit 1; \
56+
} \
57+
Remove-Item -Force git.exe; \
58+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
59+
60+
# Install Python
61+
ARG PY39=https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe
62+
ARG PY39_SHA256=FB3D0466F3754752CA7FD839A09FFE53375FF2C981279FD4BC23A005458F7F5D
63+
RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:PY39}); \
64+
Invoke-WebRequest -Uri ${env:PY39} -OutFile python-3.9.13-amd64.exe; \
65+
Write-Host '✓'; \
66+
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${env:PY39_SHA256});\
67+
$Hash = Get-FileHash python-3.9.13-amd64.exe -Algorithm sha256; \
68+
if ($Hash.Hash -eq ${env:PY39_SHA256}) { \
69+
Write-Host '✓'; \
70+
} else { \
71+
Write-Host ('✘ ({0})' -f $Hash.Hash); \
72+
exit 1; \
73+
} \
74+
Write-Host -NoNewLine 'Installing Python ... '; \
75+
$Process = \
76+
Start-Process python-3.9.13-amd64.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
77+
'AssociateFiles=0', \
78+
'Include_doc=0', \
79+
'Include_debug=0', \
80+
'Include_lib=1', \
81+
'Include_tcltk=0', \
82+
'Include_test=0', \
83+
'InstallAllUsers=1', \
84+
'InstallLauncherAllUsers=0', \
85+
'PrependPath=1', \
86+
'/quiet' \
87+
); \
88+
if ($Process.ExitCode -eq 0) { \
89+
Write-Host '✓'; \
90+
} else { \
91+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
92+
exit 1; \
93+
} \
94+
Remove-Item -Force python-3.9.13-amd64.exe; \
95+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
96+
97+
# Install Visual Studio Build Tools
98+
ARG VSB=https://aka.ms/vs/17/release/vs_buildtools.exe
99+
ARG VSB_SHA256=D4E08524CB0E5BD061A24F507928D1CFB91DCE192C5E12ED964B8343FC4CDEDD
100+
RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:VSB}); \
101+
Invoke-WebRequest -Uri ${env:VSB} -OutFile vs_buildtools.exe; \
102+
Write-Host '✓'; \
103+
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${env:VSB_SHA256}); \
104+
$Hash = Get-FileHash vs_buildtools.exe -Algorithm sha256; \
105+
if ($Hash.Hash -eq ${env:VSB_SHA256}) { \
106+
Write-Host '✓'; \
107+
} else { \
108+
Write-Host ('✘ ({0})' -f $Hash.Hash); \
109+
} \
110+
Write-Host -NoNewLine 'Installing Visual Studio Build Tools ... '; \
111+
$Process = \
112+
Start-Process vs_buildtools.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
113+
'--quiet', \
114+
'--wait', \
115+
'--norestart', \
116+
'--nocache', \
117+
'--add', 'Microsoft.VisualStudio.Component.Windows11SDK.22000', \
118+
'--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' \
119+
); \
120+
if ($Process.ExitCode -eq 0 -or $Process.ExitCode -eq 3010) { \
121+
Write-Host '✓'; \
122+
} else { \
123+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
124+
exit 1; \
125+
} \
126+
Remove-Item -Force vs_buildtools.exe; \
127+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
128+
129+
# Install Swift toolchain.
130+
ARG SWIFT_RELEASE_METADATA=http://download.swift.org/swift-6.0-branch/windows10/latest-build.json
131+
RUN $env:Release = curl.exe -sL ${env:SWIFT_RELEASE_METADATA}; \
132+
$env:SWIFT = "https://download.swift.org/swift-6.0-branch/windows10/$($($env:Release | ConvertFrom-JSON).dir)/$($($env:Release | ConvertFrom-JSON).download)"; \
133+
Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:SWIFT}); \
134+
Invoke-WebRequest -Uri ${env:SWIFT} -OutFile installer.exe; \
135+
Write-Host '✓'; \
136+
Write-Host -NoNewLine 'Installing Swift ... '; \
137+
$Process = \
138+
Start-Process installer.exe -Wait -PassThru -NoNewWindow -ArgumentList @( \
139+
'/quiet', \
140+
'/norestart' \
141+
); \
142+
if ($Process.ExitCode -eq 0) { \
143+
Write-Host '✓'; \
144+
} else { \
145+
Write-Host ('✘ ({0})' -f $Process.ExitCode); \
146+
exit 1; \
147+
} \
148+
Remove-Item -Force installer.exe; \
149+
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse ${env:TEMP}\*
150+
151+
# FIXME: we should use a non-Administrator user
152+
# USER ContainerUser
153+
CMD ["powershell.exe", "-nologo", "-ExecutionPolicy", "Bypass"]

0 commit comments

Comments
 (0)