|
| 1 | +# Agent image for LLVM org cluster. |
| 2 | +# .net 4.8 is required by chocolately package manager. |
| 3 | +FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 |
| 4 | + |
| 5 | +# Restore the default Windows shell for correct batch processing. |
| 6 | +SHELL ["cmd", "/S", "/C"] |
| 7 | + |
| 8 | +# Download the Build Tools bootstrapper. |
| 9 | +ADD https://aka.ms/vs/16/release/vs_buildtools.exe /TEMP/vs_buildtools.exe |
| 10 | + |
| 11 | +RUN powershell -Command Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) |
| 12 | + |
| 13 | +# Download channel for fixed install. |
| 14 | +ARG CHANNEL_URL=https://aka.ms/vs/16/release/channel |
| 15 | +ADD ${CHANNEL_URL} /TEMP/VisualStudio.chman |
| 16 | + |
| 17 | +# Install Build Tools with C++ workload. |
| 18 | +# - Documentation for docker installation |
| 19 | +# https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2019 |
| 20 | +# - Documentation on workloads |
| 21 | +# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019#c-build-tools |
| 22 | +# - Documentation on flags |
| 23 | +# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2019 |
| 24 | +RUN /TEMP/vs_buildtools.exe --quiet --wait --norestart --nocache \ |
| 25 | + --channelUri C:\TEMP\VisualStudio.chman \ |
| 26 | + --installChannelUri C:\TEMP\VisualStudio.chman \ |
| 27 | + --installPath C:\BuildTools \ |
| 28 | + --add Microsoft.VisualStudio.Workload.VCTools \ |
| 29 | + --add Microsoft.VisualStudio.Component.VC.ATL \ |
| 30 | + --includeRecommended \ |
| 31 | + || IF "%ERRORLEVEL%"=="3010" EXIT 0 |
| 32 | + |
| 33 | +# Register DIA dll (Debug Interface Access) so it can be used to symbolize |
| 34 | +# the stack traces. Register dll for 32 and 64 bit. |
| 35 | +# see https://developercommunity.visualstudio.com/content/problem/290674/msdia140dll-is-not-registered-on-vs2017-hosts.html |
| 36 | + |
| 37 | +RUN regsvr32 /S "C:\BuildTools\DIA SDK\bin\amd64\msdia140.dll" & \ |
| 38 | + regsvr32 /S "C:\BuildTools\DIA SDK\bin\msdia140.dll" |
| 39 | + |
| 40 | +# install tools as described in https://llvm.org/docs/GettingStartedVS.html |
| 41 | +# and a few more that were not documented... |
| 42 | +RUN choco install -y ninja git |
| 43 | +# Pin an older version of Python; the current Python 3.10 fails when |
| 44 | +# doing "pip install" for the other dependencies, as it fails to find libxml |
| 45 | +# while compiling some package. |
| 46 | +RUN choco install -y python3 --version 3.9.7 |
| 47 | + |
| 48 | +# ActivePerl is currently not installable via Chocolatey, see |
| 49 | +# http://disq.us/p/2ipditb. Install StrawberryPerl instead. Unfortunately, |
| 50 | +# StrawberryPerl not only installs Perl, but also a redundant C/C++ compiler |
| 51 | +# toolchain, and a copy of pkg-config which can cause misdetections for other |
| 52 | +# built products, see |
| 53 | +# https://github.com/StrawberryPerl/Perl-Dist-Strawberry/issues/11 for further |
| 54 | +# details. Remove the redundant and unnecessary parts of the StrawberryPerl |
| 55 | +# install. |
| 56 | +RUN choco install -y strawberryperl && \ |
| 57 | + rmdir /q /s c:\strawberry\c && \ |
| 58 | + del /q c:\strawberry\perl\bin\pkg-config* |
| 59 | + |
| 60 | +# libcxx requires clang(-cl) to be available |
| 61 | +RUN choco install -y sccache llvm |
| 62 | +RUN pip install psutil |
| 63 | + |
| 64 | +RUN curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-x86_64.zip && \ |
| 65 | + powershell Expand-Archive llvm-mingw-*-ucrt-x86_64.zip -DestinationPath . && \ |
| 66 | + del llvm-mingw-*-ucrt-x86_64.zip && \ |
| 67 | + ren llvm-mingw-20230320-ucrt-x86_64 llvm-mingw |
| 68 | + |
| 69 | +# configure Python encoding |
| 70 | +ENV PYTHONIOENCODING=UTF-8 |
| 71 | + |
| 72 | +# update the path variable |
| 73 | +# C:\Program Files\Git\usr\bin contains a usable bash and other unix tools. |
| 74 | +# C:\llvm-mingw\bin contains Clang configured for mingw targets and |
| 75 | +# corresponding sysroots. Both the 'llvm' package (with Clang defaulting |
| 76 | +# to MSVC targets) and this directory contains executables named |
| 77 | +# 'clang.exe' - add this last to let the other one have precedence. |
| 78 | +# To use these compilers, use the triple prefixed form, e.g. |
| 79 | +# x86_64-w64-mingw32-clang. |
| 80 | +# C:\buildtools and SDK paths are ones that are set by c:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=amd64 -host_arch=amd64 |
| 81 | +RUN powershell -Command \ |
| 82 | + [System.Environment]::SetEnvironmentVariable('PATH', \ |
| 83 | + [System.Environment]::GetEnvironmentVariable('PATH', 'machine') + ';C:\Program Files\Git\usr\bin;C:\llvm-mingw\bin' \ |
| 84 | + + ';C:\BuildTools\Common7\IDE\' \ |
| 85 | + + ';C:\BuildTools\Common7\IDE\CommonExt ensions\Microsoft\TeamFoundation\Team Explorer' \ |
| 86 | + + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin' \ |
| 87 | + + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja' \ |
| 88 | + + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer' \ |
| 89 | + + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow' \ |
| 90 | + + ';C:\BuildTools\Common7\IDE\VC\VCPackages' \ |
| 91 | + + ';C:\BuildTools\Common7\Tools\' \ |
| 92 | + + ';C:\BuildTools\Common7\Tools\devinit' \ |
| 93 | + + ';C:\BuildTools\MSBuild\Current\Bin' \ |
| 94 | + + ';C:\BuildTools\MSBuild\Current\bin\Roslyn' \ |
| 95 | + + ';C:\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64' \ |
| 96 | + + ';C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\' \ |
| 97 | + + ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64' \ |
| 98 | + + ';C:\Program Files (x86)\Windows Kits\10\bin\x64' \ |
| 99 | + + ';C:\Windows\Microsoft.NET\Framework64\v4.0.30319' \ |
| 100 | + ,'machine') |
| 101 | +
|
| 102 | +# support long file names during git checkout |
| 103 | +RUN git config --system core.longpaths true & \ |
| 104 | + git config --global core.autocrlf false |
| 105 | +
|
| 106 | +# handle for debugging of files beeing locked by some processes. |
| 107 | +RUN choco install -y handle |
| 108 | +
|
| 109 | +RUN pip3 install pywin32 buildbot-worker==2.8.4 |
| 110 | +
|
| 111 | +ARG RUNNER_VERSION=2.319.1 |
| 112 | +ENV RUNNER_VERSION=$RUNNER_VERSION |
| 113 | +
|
| 114 | +RUN powershell -Command \ |
| 115 | + Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v${env:RUNNER_VERSION}/actions-runner-win-x64-${env:RUNNER_VERSION}.zip -OutFile actions-runner-win.zip ; \ |
| 116 | + Add-Type -AssemblyName System.IO.Compression.FileSystem ; \ |
| 117 | + [System.IO.Compression.ZipFile]::ExtractToDirectory('actions-runner-win.zip', $PWD) ;\ |
| 118 | + rm actions-runner-win.zip |
0 commit comments