Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitjano committed Apr 27, 2024
1 parent 2095dec commit 8f4c74e
Showing 1 changed file with 65 additions and 60 deletions.
125 changes: 65 additions & 60 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,68 @@ 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"]
# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/16/release/channel
ADD ${CHANNEL_URL} %TEMP%\VisualStudio.chman

# Download and install Build Tools for Visual Studio 2019 for native desktop workload.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe %TEMP%\vs_buildtools.exe
RUN %TEMP%\vs_buildtools.exe --quiet --wait --norestart --nocache \
--channelUri %TEMP%\VisualStudio.chman \
--installChannelUri %TEMP%\VisualStudio.chman \
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended \
--add Microsoft.VisualStudio.Component.VC.ATL \
--add Microsoft.VisualStudio.Component.VC.ATLMFC \
--installPath C:\BuildTools

# Install NuGet as package pprovider (needed for find-vs.ps1).
RUN powershell Install-PackageProvider -Name NuGet -Force

# Download, unzip, and add ccache to path
ADD https://github.com/ccache/ccache/releases/download/v4.7.1/ccache-4.7.1-windows-x86_64.zip %TEMP%\ccache.zip
RUN powershell Expand-Archive -Path %TEMP%\ccache.zip -DestinationPath C:\ccache
RUN setx /M PATH "%PATH%;C:\ccache\ccache-4.7.1-windows-x86_64"

# Download and install git.
ADD https://github.com/git-for-windows/git/releases/download/v2.38.0.windows.1/Git-2.38.0-64-bit.exe %TEMP%\git-install.exe
RUN %TEMP%\git-install.exe /VERYSILENT /NORESTART
RUN setx /M PATH "%PATH%;C:\Program Files\Git\bin"

# Download and install python versions.
ADD https://www.python.org/ftp/python/3.11.0/python-3.11.0-amd64.exe %TEMP%\python311-install.exe
RUN %TEMP%\python311-install.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
RUN ("C:\Program Files\Python311/python.exe" -m pip install wheel numpy pyyaml pybind11 cocotb cocotb-test jinja2 psutil)

ADD https://www.python.org/ftp/python/3.10.8/python-3.10.8-amd64.exe %TEMP%\python310-install.exe
RUN %TEMP%\python310-install.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
RUN ("C:\Program Files\Python310/python.exe" -m pip install wheel numpy pyyaml pybind11 cocotb cocotb-test jinja2 psutil)

ADD https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe %TEMP%\python39-install.exe
RUN %TEMP%\python39-install.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
RUN ("C:\Program Files\Python39/python.exe" -m pip install wheel numpy pyyaml pybind11 cocotb cocotb-test jinja2 psutil)

ADD https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe %TEMP%\python38-install.exe
RUN %TEMP%\python38-install.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
RUN ("C:\Program Files\Python38\python.exe" -m pip install wheel numpy pyyaml pybind11 cocotb cocotb-test jinja2 psutil)

ADD https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe %TEMP%\python37-install.exe
RUN %TEMP%\python37-install.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
RUN ("C:\Program Files\Python37\python.exe" -m pip install wheel numpy pyyaml pybind11 cocotb cocotb-test jinja2 psutil)

# Get latest version of cmake
ADD https://github.com/Kitware/CMake/releases/download/v3.26.0/cmake-3.26.0-windows-x86_64.msi %TEMP%\cmake.msi
RUN msiexec /i %TEMP%\cmake.msi

# Install PowerShell
ADD https://github.com/PowerShell/PowerShell/releases/download/v7.3.0/PowerShell-7.3.0-win-x86.msi %TEMP%\pwsh-install.msi
RUN msiexec /i %TEMP%\pwsh-install.msi

# Clone and bootstrap vcpkg.
RUN cd c:\ && git clone https://github.com/Microsoft/vcpkg.git && .\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

0 comments on commit 8f4c74e

Please sign in to comment.