1
+ # escape=`
2
+ # https://learn.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2022
3
+
4
+ # Use the latest Windows Server Core 2022 image.
5
+ FROM mcr.microsoft.com/windows-cssc/python:3.11-servercore-ltsc2019
6
+
7
+ # Restore the default Windows shell for correct batch processing.
8
+ SHELL ["cmd" , "/S" , "/C" ]
9
+
10
+ RUN `
11
+ # Download the Build Tools bootstrapper.
12
+ curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
13
+ `
14
+ # Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.
15
+ && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
16
+ --installPath "%ProgramFiles(x86)%\M icrosoft Visual Studio\2 022\B uildTools" `
17
+ --add Microsoft.VisualStudio.Workload.AzureBuildTools `
18
+ --add Microsoft.VisualStudio.Workload.VCTools `
19
+ --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
20
+ --add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
21
+ --add Microsoft.VisualStudio.Component.VC.CMake.Project `
22
+ --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
23
+ --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
24
+ --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
25
+ --remove Microsoft.VisualStudio.Component.Windows81SDK `
26
+ || IF "%ERRORLEVEL%" =="3010" EXIT 0) `
27
+ `
28
+ # Cleanup
29
+ && del /q vs_buildtools.exe
30
+
31
+
32
+ RUN powershell.exe -Command `
33
+ $ErrorActionPreference = 'Stop' ; `
34
+ Invoke-WebRequest -Uri "https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/Git-2.45.2-64-bit.exe" -OutFile "C:\\ Git-2.45.2-64-bit.exe" ; `
35
+ Start-Process -FilePath "C:\\ Git-2.45.2-64-bit.exe" -ArgumentList '/VERYSILENT' , '/NORESTART' -Wait; `
36
+ Remove-Item -Force "C:\\ Git-2.45.2-64-bit.exe"
37
+
38
+
39
+ RUN powershell.exe -Command `
40
+ $ErrorActionPreference = 'Stop' ; `
41
+ Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "C:\\ vc_redist.x64.exe" ; `
42
+ Start-Process -FilePath "C:\\ vc_redist.x64.exe" -ArgumentList '/install' , '/quiet' , '/norestart' -Wait; `
43
+ Remove-Item -Force "C:\\ vc_redist.x64.exe" ;
44
+
45
+
46
+ # Set environment variables
47
+ ENV BOOST_VERSION=1.81.0
48
+ ENV BOOST_VERSION_UNDERSCORE=1_81_0
49
+
50
+ # Download and install Boost from GitHub using PowerShell and tar
51
+ RUN powershell.exe -Command `
52
+ $ErrorActionPreference = 'Stop' ; `
53
+ Invoke-WebRequest -Uri "https://github.com/MarkusJx/prebuilt-boost/releases/download/$env:BOOST_VERSION/boost-$env:BOOST_VERSION-windows-2022-msvc-shared-x86.tar.gz" -OutFile "C:\\ boost_%BOOST_VERSION_UNDERSCORE%.tar.gz" ; `
54
+ tar -xf C:\\ boost_$env:BOOST_VERSION_UNDERSCORE.tar.gz -C C:\\ ; `
55
+ Remove-Item -Force C:\\ boost_$env:BOOST_VERSION_UNDERSCORE.tar.gz
56
+
57
+
58
+ # Download and install 7zip
59
+ RUN powershell -Command `
60
+ $ErrorActionPreference = 'Stop' ; `
61
+ Invoke-WebRequest -Uri https://www.7-zip.org/a/7z1900-x64.msi -OutFile C:\7 z1900-x64.msi; `
62
+ Start-Process msiexec.exe -ArgumentList '/i' , 'C:\7 z1900-x64.msi' , '/quiet' , '/norestart' -NoNewWindow -Wait; `
63
+ Remove-Item C:\7 z1900-x64.msi
64
+
65
+ ENV BOOST_ROOT C:\b oost
66
+ RUN setx PATH "%PATH%;%BOOST_ROOT%\l ib;C:\P rogram Files\7 -Zip"
67
+
68
+ # Define the entry point for the docker container.
69
+ # This entry point starts the developer command prompt and launches the PowerShell shell.
70
+ ENTRYPOINT ["C:\\ Program Files (x86)\\ Microsoft Visual Studio\\ 2022\\ BuildTools\\ Common7\\ Tools\\ VsDevCmd.bat" , "-arch=amd64" , "&&" , "powershell.exe" , "-NoLogo" , "-ExecutionPolicy" , "Bypass" ]
0 commit comments