Skip to content

Commit 68c5a1d

Browse files
committed
Introduce a Dockerfile for Windows
This allows one to build a Windows container for Swift. Although it is not perfect, it is sufficient for basic tasks. The Git installation should preferably enable symbolic link support which although it is marked to do does not seem to be enabled. The Python installation should preferably set `PYTHONHOME` and `PYTHONPATH`. This will become increasingly important as further refinements to the toolchain start getting merged.
1 parent 1e5b583 commit 68c5a1d

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

5.6/windows/20H2/Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# escape=`
2+
3+
FROM mcr.microsoft.com/windows/servercore:20H2 AS windows
4+
5+
LABEL maintainer="Swift Infrastructure <[email protected]>"
6+
LABEL description="Docker Container for the Swift programming language"
7+
8+
ARG GIT=https://github.com/git-for-windows/git/releases/download/v2.35.1.windows.2/Git-2.35.1.2-64-bit.exe
9+
ARG INSTALLER=https://download.swift.org/swift-5.6.1-release/windows10/swift-5.6.1-RELEASE/swift-5.6.1-RELEASE-windows10.exe
10+
ARG PYTHON=https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe
11+
12+
# restore the default Windows shell for correct batch processing
13+
SHELL ["cmd", "/S", "/C"]
14+
15+
# Install Visual Studio Build Tools
16+
RUN `
17+
curl -SLo vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
18+
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
19+
--add Microsoft.VisualStudio.Component.Windows11SDK.22000 `
20+
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
21+
|| IF "%EXITCODE%"=="3010" EXIT 0) `
22+
&& del /q vs_buildtools.exe
23+
24+
# Install Swift toolchain.
25+
RUN `
26+
curl -SLo installer.exe %INSTALLER% `
27+
&& (start /w installer.exe -q) `
28+
&& del /q installer.exe
29+
30+
# Install Git.
31+
# See: git-[version]-[bit].exe /SAVEINF=git.inf and /?
32+
RUN `
33+
curl -SLo git.exe %GIT% `
34+
&& (start /w git.exe /SP- /VERYSILENT /SUPPRESSMSGBOXES /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS /NOICONS /COMPONENTS="gitlfs" /EditorOption=VIM /PathOption=Cmd /SSHOption=OpenSSH /CURLOption=WinSSL /UseCredentialManager=Enabled /PerformanceTweaksFSCache=Enabled /EnableSymlinks=Enabled /EnableFSMonitor=Enabled ) `
35+
&& del /q git.exe
36+
37+
# Install Python.
38+
# See: https://docs.python.org/3.10/using/windows.html
39+
# FIXME: it appears that `PYTHONHOME` and `PYTHONPATH` are unset
40+
RUN `
41+
curl -SLo python.exe %PYTHON% `
42+
&& (start /w python.exe /quiet InstallAllUsers=1 AssociateFiles=0 PrependPath=1 Shortcuts=0 Include_doc=0 Include_debug=0 Include_dev=0 Include_exe=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_lib=1 Include_pip=0 Include_symbols=0 Include_tcltk=0 Include_test=0 Include_tools=0 ) `
43+
&& del /q python.exe
44+
45+
# Default to powershell
46+
# FIXME: we need to grant ContainerUser the SeCreateSymbolicLinkPrivilege
47+
# privilege so that it can create symbolic links.
48+
# USER ContainerUser
49+
CMD ["powershell.exe", "-nologo", "-ExecutionPolicy", "Bypass"]

0 commit comments

Comments
 (0)