diff --git a/docker/windows-release-builder.Dockerfile b/docker/windows-release-builder.Dockerfile index 4aa3459..2b73426 100644 --- a/docker/windows-release-builder.Dockerfile +++ b/docker/windows-release-builder.Dockerfile @@ -1,36 +1,32 @@ -FROM mcr.microsoft.com/windows/servercore:ltsc2022 +# escape=` -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] +# Use a Windows Server Core 2025 image that matches our build host. +# If the version doesn't match the build host we cannot run +# this container. I'm not sure with what specificity it has to +# match, so let's pin this and then upgrade it as we upgrade +# the host. +FROM mcr.microsoft.com/windows/servercore:10.0.26100.7171 -RUN New-Item -ItemType Directory -Path 'C:\TEMP' -Force | Out-Null +# Restore the default Windows shell for correct batch processing. +SHELL ["cmd", "/S", "/C"] -# Download and install Visual Studio Build Tools 2022 with C++ and CMake -RUN Invoke-WebRequest -UseBasicParsing "https://aka.ms/vs/17/release/vs_buildtools.exe" -OutFile "C:\\TEMP\\vs_buildtools.exe" ; \ - Start-Process "C:\\TEMP\\vs_buildtools.exe" -Wait -ArgumentList \ - '--wait', \ - '--norestart', \ - '--nocache', \ - '--add', 'Microsoft.VisualStudio.Workload.VCTools', \ - '--add', 'Microsoft.VisualStudio.Component.VC.CMake.Project', \ - '--add', 'Microsoft.VisualStudio.Component.Windows10SDK.19041', \ - '--includeRecommended', \ - '--installPath', 'C:\\BuildTools' - -# Install Rust using the installer -RUN Invoke-WebRequest -Uri "https://win.rustup.rs" -OutFile "rustup-init.exe" ; \ - Start-Process "rustup-init.exe" -Wait -ArgumentList '-y'; \ - Remove-Item "rustup-init.exe" - -# Add Rust to PATH -RUN setx PATH "$Env:USERPROFILE\\.cargo\\bin;$Env:PATH" - -RUN $cmakeMsi = 'C:\\TEMP\\cmake-3.21.10-windows-x86_64.msi'; \ - Invoke-WebRequest -UseBasicParsing ` \ - -Uri "https://github.com/Kitware/CMake/releases/download/v3.21.10/cmake-3.21.10-windows-x86_64.msi" ` \ - -OutFile $cmakeMsi; \ - Start-Process msiexec.exe -Wait -ArgumentList "/i `"$cmakeMsi`" ADD_CMAKE_TO_PATH=System /qn"; \ - Remove-Item $cmakeMsi - -# Setup environment -CMD ["cmd.exe"] +RUN ` + # Download the Build Tools bootstrapper. + curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe ` + ` + # Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues. + && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache ` + --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" ` + --add Microsoft.VisualStudio.Workload.AzureBuildTools ` + --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 ` + --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 ` + --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 ` + --remove Microsoft.VisualStudio.Component.Windows81SDK ` + || IF "%ERRORLEVEL%"=="3010" EXIT 0) ` + ` + # Cleanup + && del /q vs_buildtools.exe +# Define the entry point for the docker container. +# This entry point starts the developer command prompt and launches the PowerShell shell. +ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]