Skip to content

Commit 3280fc3

Browse files
authored
Merge pull request #33 from chef/CHEF-15884-wind-docker-image-for-ruby-3-4-2
DockerImage for Ruby 3.4.2 on Windows
2 parents ef7e2de + b91d454 commit 3280fc3

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

.expeditor/build-windows-docker.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ steps:
1212
- id: build-and-push-on-windows-2019-server-rubydistros-dockerhub
1313
label: ":docker::windows: build-and-push-rubydistros-dockerhub"
1414
commands:
15-
- "docker build . -f 3.3/windows/2019/Dockerfile -t windows-2019:3.3"
16-
- "docker tag windows-2019:3.3 docker.io/rubydistros/windows-2019:3.3"
17-
- "docker tag windows-2019:3.3 docker.io/rubydistros/windows-2019:latest"
18-
- "docker push docker.io/rubydistros/windows-2019:3.3"
15+
- "docker build . -f 3.4/windows/2019/Dockerfile -t windows-2019:3.4"
16+
- "docker tag windows-2019:3.4 docker.io/rubydistros/windows-2019:3.4"
17+
- "docker tag windows-2019:3.4 docker.io/rubydistros/windows-2019:latest"
18+
- "docker push docker.io/rubydistros/windows-2019:3.4"
1919
- "docker push docker.io/rubydistros/windows-2019:latest"
2020
agents:
2121
queue: docker-windows-2019
2222
plugins:
2323
- docker-login#v2.1.0:
24-
username: expeditor
24+
username: expeditor

3.4/windows/2019/Dockerfile

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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:\ndp472-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:\chocolatey_install.ps1
17+
RUN C:\ProgramData\Chocolatey\bin\refreshenv -and \
18+
choco feature enable -n=allowGlobalConfirmation -and \
19+
choco config set cacheLocation C:\chococache -and \
20+
choco upgrade chocolatey -and \
21+
rmdir /q /s C:\chococache -and \
22+
del C:\chocolatey_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:\rubyinstaller-devkit-3.4.2-1-x64.exe -ArgumentList '/verysilent /allusers /dir=C:\\ruby33' -Wait ; \
38+
Write-Output 'Cleaning up installation'; \
39+
Remove-Item c:\rubyinstaller-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+
.\msys2-x86_64-20250221.exe in --confirm-command --accept-messages --root C:\msys2 ; \
46+
[Environment]::SetEnvironmentVariable('PATH', $env:PATH + ';C:\msys2', [EnvironmentVariableTarget]::Machine); \
47+
Remove-Item 'C:\msys2-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

Comments
 (0)