From d5bfb2e5f2f89cf402ed562218023da1863acd4a Mon Sep 17 00:00:00 2001 From: Jean Felder Date: Sat, 27 Apr 2024 13:47:43 +0200 Subject: [PATCH] test --- Dockerfile.windows | 84 ++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 59 deletions(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index 6a268eb6..a4ba548b 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -3,63 +3,29 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2022 # Reset the shell. SHELL ["cmd", "/S", "/C"] -# install powershell core -RUN powershell Invoke-WebRequest -Uri https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/PowerShell-7.4.2-win-x64.msi -OutFile $env:TEMP\powershell.msi ; \ - Start-Process -Wait -FilePath msiexec.exe -ArgumentList '/i', '$env:TEMP\powershell.msi', '/quiet', '/norestart' ; \ - Remove-Item $env:TEMP\powershell.msi -Force -ENV PATH="${PATH};C:\Windows\System32\WindowsPowerShell\v1.0" - -# download and install vs build tools needed by vcpkg -RUN powershell -Command \ - Invoke-WebRequest -Uri https://aka.ms/vs/17/release/channel -OutFile $env:TEMP\VisualStudio.chman; \ - Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile $env:TEMP\vs_buildtools.exe; \ - Start-Process -Wait -FilePath "$env:TEMP\vs_buildtools.exe" \ - -ArgumentList "--wait", "--nocache", "--norestart", "--noUpdateInstaller", \ - "--channelUri", "$env:TEMP\VisualStudio.chman", \ - "--installChannelUri", "$env:TEMP\VisualStudio.chman", \ - "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", \ - "--add", "Microsoft.Component.MSBuild", \ - "--add", "Microsoft.VisualStudio.Component.Windows11SDK.22621", \ - "--includeRecommended"; \ - Remove-Item $env:TEMP\VisualStudio.chman -Force; \ - Remove-Item $env:TEMP\vs_buildtools.exe -Force - -# install git -RUN powershell -Command \ - Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-64-bit.exe -OutFile $env:TEMP\git-installer.exe ; \ - Start-Process -Wait -FilePath "$env:TEMP\git-installer.exe" -ArgumentList '/VERYSILENT', '/NORESTART' ; \ - Remove-Item $env:TEMP\git-installer.exe -Force -ENV PATH="${PATH};C:\Program Files\Git\cmd" - -# install cmake -RUN powershell -Command \ - Invoke-WebRequest -Uri https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-windows-x86_64.msi -OutFile $env:TEMP\cmake-installer.msi ; \ - Start-Process -Wait -FilePath msiexec.exe -ArgumentList '/i', '$env:TEMP\cmake-installer.msi', '/quiet', '/norestart' ; \ - Remove-Item $env:TEMP\cmake-installer.msi -Force -ENV PATH="${PATH};C:\Program Files\CMake\bin" - -# add MSVC path -ENV PATH="${PATH};C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" -ENV PATH="${PATH};C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64" - -# install vcpkg -RUN git clone https://github.com/microsoft/vcpkg c:\vcpkg && \ - c:\vcpkg\bootstrap-vcpkg.bat -disableMetrics -ENV VCPKG_DEFAULT_TRIPLET=x64-windows -ENV PATH="${PATH};C:\vcpkg" - -# install sfcgal dependencies -RUN vcpkg integrate install && \ - vcpkg install cgal boost-program-options boost-timer boost-test - -# build sfcgal -# # RUN cd $env:starter_path; \ -# # cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSFCGAL_BUILD_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALL_DIR\scripts\buildsystems\vcpkg.cmake" -# RUN cmake -S . -B build \ -# -DCMAKE_BUILD_TYPE=Release \ -# -DSFCGAL_BUILD_TESTS=OFF \ -# -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALL_DIR\scripts\buildsystems\vcpkg.cmake" - -# # Default to PowerShell if no other command specified. -# CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] +# Install Chocolatey & packages +RUN powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command \ + "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \ + SETX PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" + +RUN choco install --no-progress -y git +RUN choco install --no-progress -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' +RUN choco install --ignoredetectedreboot --no-progress -y visualstudio2022buildtools \ + --package-parameters \ + "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \ + --add Microsoft.Component.MSBuild \ + --add Microsoft.VisualStudio.Component.Windows11SDK.22621 \ + --includeRecommended --nocache --installPath %MSVC_PATH%" \ + || IF "%ERRORLEVEL%"=="3010" EXIT 0 + +# Clone and bootstrap vcpkg. +RUN git clone https://github.com/Microsoft/vcpkg.git c:\vcpkg && \ + c:\vcpkg\bootstrap-vcpkg.bat + +# Install capnproto via vcpkg. +RUN c:\vcpkg\vcpkg install capnproto:x64-windows + +# Use developer command prompt and start PowerShell if no other command specified. +ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=x64 -host_arch=x64 && +CMD powershell.exe -NoLogo -ExecutionPolicy Bypass