Updated dockerfile for Windows

This commit is contained in:
Elad Solomon 2022-05-22 10:41:17 +00:00 committed by Tomer Lev
parent d7734ca783
commit 27d0bbde0f

View file

@ -1,28 +1,6 @@
# escape=` # escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
# Download the Build Tools bootstrapper.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
# Install Build Tools.
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended `
--add Microsoft.VisualStudio.Component.VC.ATLMFC `
--add Microsoft.VisualStudio.Component.Windows10SDK.18362 `
--add Microsoft.VisualStudio.Component.Windows10SDK.17763 `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 `
--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
SHELL [ "powershell" ] SHELL [ "powershell" ]
RUN Set-ExecutionPolicy Unrestricted -Force RUN Set-ExecutionPolicy Unrestricted -Force
@ -31,22 +9,23 @@ RUN Set-ExecutionPolicy Unrestricted -Force
RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ` RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
# Install prerequisites # Install prerequisites
RUN choco install -y --no-progress visualstudio2019buildtools --version=16.11.11.0
RUN choco install -y --no-progress visualstudio2019-workload-vctools --version=1.0.0 --package-parameters '--add Microsoft.VisualStudio.Component.VC.ATLMFC'
RUN choco install powershell-core -y RUN choco install powershell-core -y
RUN choco install conan -y RUN choco install conan -y
RUN choco install sed -y RUN choco install sed -y
RUN choco install winflexbison -y RUN choco install winflexbison -y
# Can't install a proper msys2 because it caused console hanging in the container during docker build. # Can't install a proper msys2 because it caused console hanging in the container during docker build.
RUN choco install msysgit -y RUN choco install msysgit -y
RUN choco install python -y
# Set working environment. # Set working environment.
SHELL [ "cmd", "/c" ]
RUN setx /M PATH "%PATH%;C:\\Program Files\\Git\\bin" RUN setx /M PATH "%PATH%;C:\\Program Files\\Git\\bin"
RUN setx /M CONAN_SKIP_BROKEN_SYMLINKS_CHECK 1
RUN mkdir C:\build RUN mkdir C:\build
WORKDIR C:\build WORKDIR C:\build
# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell. # This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&", "pwsh.exe", "-NoLogo", "-ExecutionPolicy", "Unrestricted"] ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=x64", "&&", "pwsh.exe", "-NoLogo", "-ExecutionPolicy", "Unrestricted"]