|
| 1 | +# escape=` |
| 2 | + |
| 3 | +FROM mcr.microsoft.com/windows/servercore:10.0.20348.1487 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.36.0.windows.1/Git-2.36.0-64-bit.exe |
| 9 | +ARG PYTHON=https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe |
| 10 | +ARG SWIFT_SNAPSHOT=https://download.swift.org/swift-5.8-branch/windows10/swift-5.8-DEVELOPMENT-SNAPSHOT-2023-01-09-a/swift-5.8-DEVELOPMENT-SNAPSHOT-2023-01-09-a-windows10.exe |
| 11 | + |
| 12 | +# restore the default Windows shell for correct batch processing |
| 13 | +SHELL ["cmd", "/S", "/C"] |
| 14 | + |
| 15 | +# Enable Developer Mode. |
| 16 | +RUN reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1" |
| 17 | + |
| 18 | +# Enable Long Paths |
| 19 | +RUN reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /t REG_DWORD /f /v "LongPathsEnabled" /d "1" |
| 20 | + |
| 21 | +# Install Git. |
| 22 | +# See: git-[version]-[bit].exe /SAVEINF=git.inf and /? |
| 23 | +COPY git.inf . |
| 24 | +RUN ` |
| 25 | + curl -SLo git.exe %GIT% ` |
| 26 | + && (start /w git.exe /SP- /VERYSILENT /SUPPRESSMSGBOXES /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS /LOADINF=git.inf ) ` |
| 27 | + && del /q git.exe git.inf |
| 28 | + |
| 29 | +# Install Python. |
| 30 | +# See: https://docs.python.org/3.10/using/windows.html |
| 31 | +# FIXME: it appears that `PYTHONHOME` and `PYTHONPATH` are unset |
| 32 | +COPY unattend.xml . |
| 33 | +RUN ` |
| 34 | + curl -SLo python.exe %PYTHON% ` |
| 35 | + && (start /w python.exe /quiet ) ` |
| 36 | + && del /q python.exe unattend.xml |
| 37 | + |
| 38 | +# Install Visual Studio Build Tools |
| 39 | +RUN ` |
| 40 | + curl -SLo vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe ` |
| 41 | + && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache ` |
| 42 | + --add Microsoft.VisualStudio.Component.Windows11SDK.22000 ` |
| 43 | + --add Microsoft.VisualStudio.Component.VC.CMake.Project ` |
| 44 | + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` |
| 45 | + --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ` |
| 46 | + --add Microsoft.VisualStudio.Component.VC.Tools.ARM ` |
| 47 | + || IF "%EXITCODE%"=="3010" EXIT 0) ` |
| 48 | + && del /q vs_buildtools.exe |
| 49 | + |
| 50 | +# Install Swift |
| 51 | +RUN ` |
| 52 | + curl -SLo installer.exe %SWIFT_SNAPSHOT% ` |
| 53 | + && (start /w installer.exe /q) ` |
| 54 | + && del /q installer.exe |
| 55 | + |
| 56 | +# FIXME: we should use a non-Administrator user |
| 57 | +# USER ContainerUser |
| 58 | + |
| 59 | +ENV PYTHONUTF8=1 |
| 60 | +# Default to powershell |
| 61 | +ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=amd64", "-host_arch=amd64", "&&", "cmd", "-nologo"] |
0 commit comments