1
+ FROM mcr.microsoft.com/windows/servercore:ltsc2019
2
+
3
+ ENV BUNDLE_SILENCE_ROOT_WARNING=true \
4
+ GIT_DISCOVERY_ACROSS_FILESYSTEM=true
5
+
6
+ # When launched by user, default to PowerShell if no other command specified.
7
+ CMD ["powershell.exe" , "-NoLogo" , "-ExecutionPolicy" , "Bypass" ]
8
+
9
+ # latest choco via PowerShell on windows2019 requires .NET, Download and install .NET Framework 4.8
10
+ FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
11
+ ADD https://go.microsoft.com/fwlink/?linkid=863265 /ndp472-kb4054530-x86-x64-allos-enu.exe
12
+ RUN C:\n dp472-kb4054530-x86-x64-allos-enu.exe /quiet /install
13
+
14
+ # Install Chocolatey (and essentials)
15
+ ADD https://chocolatey.org/install.ps1 /chocolatey_install.ps1
16
+ RUN powershell -File C:\c hocolatey_install.ps1
17
+ RUN C:\P rogramData\C hocolatey\b in\r efreshenv -and \
18
+ choco feature enable -n=allowGlobalConfirmation -and \
19
+ choco config set cacheLocation C:\c hococache -and \
20
+ choco upgrade chocolatey -and \
21
+ rmdir /q /s C:\c hococache -and \
22
+ del C:\c hocolatey_install.ps1 -and \
23
+ Write-Output "Chocolatey install complete -- closing out layer"
24
+ # install git
25
+ RUN choco install git.install -y
26
+ # from the versions which are >2.35 requires Strict repository ownership checks hence we are doing this step
27
+ # can found more on here https://github.blog/2022-04-18-highlights-from-git-2-36/#stricter-repository-ownership-checks
28
+ RUN git config --system --add safe.directory '*'
29
+ RUN git --version
30
+
31
+ # Install Ruby + Devkit
32
+ RUN $ErrorActionPreference = 'Stop' ; \
33
+ Write-Output 'Downloading Ruby + DevKit' ; \
34
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
35
+ (New-Object System.Net.WebClient).DownloadFile('https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.2-1/rubyinstaller-3.4.2-1-x64.exe' , 'c:\\ rubyinstaller-devkit-3.4.2-1-x64.exe' ); \
36
+ Write-Output 'Installing Ruby + DevKit' ; \
37
+ Start-Process c:\r ubyinstaller-devkit-3.4.2-1-x64.exe -ArgumentList '/verysilent /allusers /dir=C:\\ ruby33' -Wait ; \
38
+ Write-Output 'Cleaning up installation' ; \
39
+ Remove-Item c:\r ubyinstaller-devkit-3.4.2-1-x64.exe -Force; \
40
+ Write-Output 'Closing out the layer' ;
41
+
42
+ # Download MSYS2 dev kit, extract it and add to the PATH variable
43
+
44
+ RUN powershell -Command (New-Object System.Net.WebClient).DownloadFile('https://github.com/msys2/msys2-installer/releases/download/2025-02-21/msys2-x86_64-20250221.exe' , 'c:\\ msys2-x86_64-20250221.exe' ); \
45
+ .\m sys2-x86_64-20250221.exe in --confirm-command --accept-messages --root C:\m sys2 ; \
46
+ [Environment]::SetEnvironmentVariable('PATH' , $env:PATH + ';C:\m sys2' , [EnvironmentVariableTarget]::Machine); \
47
+ Remove-Item 'C:\m sys2-x86_64-20250221.exe'
48
+
49
+ # Install MSYS2 and MINGW development toolchain and enable it
50
+ RUN ridk install 3
51
+ RUN ridk enable
0 commit comments