Skip to content

Commit ab4da53

Browse files
committed
Create the Windows 2025 Dockerfiles (using the script)
1 parent 76fe13d commit ab4da53

2 files changed

Lines changed: 165 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# SPDX-License-Identifier: MIT
2+
3+
# See "Full Tag Listing" in https://hub.docker.com/_/microsoft-windows-servercore
4+
ARG WIN_VERSION=ltsc2025
5+
FROM mcr.microsoft.com/windows/servercore:$WIN_VERSION AS MSYS2_download
6+
7+
# We always download x86_64 MSYS2 installer, since our system itself is x86_64.
8+
ARG MSYS2_VERSION=20240507
9+
ARG MSYS2_DOWNLOAD_URL=https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-${MSYS2_VERSION}.sfx.exe
10+
RUN setx /M PATH "C:\msys64\mingw32\bin;C:\msys64\usr\bin;%PATH%" && \
11+
powershell -Command "Invoke-WebRequest -Uri %MSYS2_DOWNLOAD_URL% -OutFile C:\windows\temp\msys2-base.sfx.exe" && \
12+
C:\windows\temp\msys2-base.sfx.exe x -o"C:"
13+
# NOTE: workaround for "gpg: error reading key: Connection timed out"
14+
RUN bash -l -c "exit 0"
15+
RUN bash -l -c "pacman -Syuu --noconfirm --noprogressbar" && \
16+
bash -l -c "pacman -Syu --needed --noconfirm --noprogressbar" && \
17+
bash -l -c "pacman -Syu --needed --noconfirm --noprogressbar" && \
18+
bash -l -c " \
19+
pacman -S --needed --noconfirm --noprogressbar \
20+
mingw-w64-i686-cmake diffutils git m4 make patch tar p7zip mingw-w64-i686-7zip curl python3 \
21+
" && \
22+
bash -l -c "git config --system core.longpaths true" && \
23+
bash -l -c "pacman -Scc --noconfirm" && \
24+
echo ---- [%date% %time%] Pkg install done!
25+
# NOTE: If you hang here >10 min. You may want to `zap` temp files.
26+
# ref: https://github.com/msys2/MSYS2-packages/issues/2305#issuecomment-758162640
27+
28+
# Because we need an SJLJ toolchain on win32, we manually download one and unpack it into `C:\msys64`:
29+
ARG GCC_DOWNLOAD_URL=https://github.com/niXman/mingw-builds-binaries/releases/download/12.2.0-rt_v10-rev0/i686-12.2.0-release-posix-sjlj-rt_v10-rev0.7z
30+
RUN powershell -Command "Invoke-WebRequest -Uri %GCC_DOWNLOAD_URL% -OutFile C:\windows\temp\gcc.7z" && \
31+
cd "C:\msys64" && \
32+
bash -l -c "/c/msys64/mingw32/bin/7z -y x -- /c/windows/temp/gcc.7z" && \
33+
bash -l -c "cp /mingw32/bin/gcc.exe /mingw32/bin/cc.exe"
34+
35+
# ---- Move to new container, to drop messy build history
36+
ARG WIN_VERSION=ltsc2025
37+
FROM mcr.microsoft.com/windows/servercore:$WIN_VERSION
38+
39+
COPY --from=MSYS2_download C:/msys64 C:/msys64
40+
41+
# Install .NET runtime for i686
42+
ARG DOTNET_URL="https://download.visualstudio.microsoft.com/download/pr/c2083daf-6d33-404f-a7d6-dd3bb012a945/e241d0aff000f63ef8a49c3c7da08087/dotnet-runtime-8.0.8-win-x86.exe"
43+
ARG DOTNET_EXE="C:/windows/temp/dotnet-runtime.exe"
44+
RUN powershell -Command "\
45+
Invoke-WebRequest -Uri '%DOTNET_URL%' -OutFile '%DOTNET_EXE%' -ErrorAction Stop ; \
46+
Start-Process '%DOTNET_EXE%' -Wait -ArgumentList '/install', '/quiet', '/norestart' ; \
47+
Remove-Item '%DOTNET_EXE%'"
48+
49+
# Download Windows 11 SDK (10.0.22621.2428) and install only `signtool.exe`
50+
ARG SDK_URL="https://go.microsoft.com/fwlink/?linkid=2250105"
51+
ARG SDK_EXE="C:/windows/temp/winsdksetup.exe"
52+
RUN powershell -Command "\
53+
Invoke-WebRequest -Uri '%SDK_URL%' -OutFile '%SDK_EXE%' -ErrorAction Stop ; \
54+
Start-Process '%SDK_EXE%' -Wait -ArgumentList '/features OptionId.SigningTools', '/q', '/ceip off', '/norestart' ; \
55+
setx /M PATH ('%PATH%;' + (Resolve-Path 'C:/Program Files (x86)/Windows Kits/10/bin/*/x64/')) ; \
56+
Remove-Item '%SDK_EXE%'"
57+
58+
# Install Visual C++ redistributables
59+
RUN powershell -Command "Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 -Force; Set-PSRepository -Name PSGallery -InstallationPolicy Trusted; Install-Module -Name VcRedist -SkipPublisherCheck -Force -ErrorAction Stop"
60+
61+
# Install AWS CLI
62+
RUN msiexec.exe /i "https://awscli.amazonaws.com/AWSCLIV2.msi" /quiet /qn && \
63+
setx /M PATH "%PATH%;C:\Program Files\Amazon\AWSCLIV2"
64+
65+
# Install `TrustedSigning` powershell module
66+
RUN powershell -Command "Install-Module -Name TrustedSigning"
67+
68+
69+
# Set default environment variables and setup useful symlinks
70+
# Note that we add an entry for `buildkite-agent` here despite it not being within
71+
# the image, because we expect it to be mounted within us in the future.
72+
RUN setx /M PATH "C:\buildkite-agent\bin;C:\msys64\mingw32\bin;C:\msys64\usr\bin;%PATH%" && \
73+
mklink /J C:\msys64\home\ContainerUser C:\Users\ContainerUser && \
74+
setx /M HOME C:\msys64\home\ContainerUser
75+
WORKDIR C:/home/ContainerUser
76+
77+
# Select the mingw64 environment: https://www.msys2.org/docs/environments/
78+
ENV MSYSTEM=MINGW64
79+
80+
# Default to `bash` for interactive builds
81+
CMD ["bash"]
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# SPDX-License-Identifier: MIT
2+
3+
# See "Full Tag Listing" in https://hub.docker.com/_/microsoft-windows-servercore
4+
ARG WIN_VERSION=ltsc2025
5+
FROM mcr.microsoft.com/windows/servercore:$WIN_VERSION AS MSYS2_download
6+
7+
# We always download x86_64 MSYS2 installer, since our system itself is x86_64.
8+
ARG MSYS2_VERSION=20240507
9+
ARG MSYS2_DOWNLOAD_URL=https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-${MSYS2_VERSION}.sfx.exe
10+
RUN setx /M PATH "C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%" && \
11+
powershell -Command "Invoke-WebRequest -Uri %MSYS2_DOWNLOAD_URL% -OutFile C:/windows/temp/msys2-base.sfx.exe" && \
12+
C:\windows\temp\msys2-base.sfx.exe x -o"C:"
13+
# NOTE: workaround for "gpg: error reading key: Connection timed out"
14+
RUN bash -l -c "exit 0"
15+
RUN bash -l -c "pacman -Syuu --noconfirm --noprogressbar" && \
16+
bash -l -c "pacman -Syu --needed --noconfirm --noprogressbar" && \
17+
bash -l -c "pacman -Syu --needed --noconfirm --noprogressbar" && \
18+
bash -l -c " \
19+
pacman -S --needed --noconfirm --noprogressbar \
20+
mingw-w64-x86_64-cmake diffutils git m4 make patch tar p7zip curl python3 openssl gnupg2 \
21+
mingw-w64-x86_64-gcc \
22+
" && \
23+
bash -l -c "git config --system core.longpaths true" && \
24+
bash -l -c "pacman -Scc --noconfirm" && \
25+
echo ---- [%date% %time%] Pkg install done!
26+
# NOTE: If you hang here >10 min. You may want to `zap` temp files.
27+
# ref: https://github.com/msys2/MSYS2-packages/issues/2305#issuecomment-758162640
28+
29+
30+
# ---- Move to new container, to drop messy build history
31+
ARG WIN_VERSION=ltsc2025
32+
FROM mcr.microsoft.com/windows/servercore:$WIN_VERSION
33+
34+
COPY --from=MSYS2_download C:/msys64 C:/msys64
35+
36+
# Install .NET runtime for x86_64
37+
ARG DOTNET_URL="https://download.visualstudio.microsoft.com/download/pr/cc913baa-9bce-482e-bdfc-56c4b6fafd10/e3f24f2ab2fc02b395c1b67f5193b8d1/dotnet-runtime-8.0.8-win-x64.exe"
38+
ARG DOTNET_EXE="C:/windows/temp/dotnet-runtime.exe"
39+
RUN powershell -Command "\
40+
Invoke-WebRequest -Uri '%DOTNET_URL%' -OutFile '%DOTNET_EXE%' -ErrorAction Stop ; \
41+
Start-Process '%DOTNET_EXE%' -Wait -ArgumentList '/install', '/quiet', '/norestart' ; \
42+
Remove-Item '%DOTNET_EXE%'"
43+
44+
# Install trusted signing dlib
45+
ARG TS_URL="https://www.nuget.org/api/v2/package/Microsoft.Trusted.Signing.Client/1.0.60"
46+
ARG TS_ZIP="C:/windows/temp/ts_client.zip"
47+
ARG TS_DIR="C:/Program Files/TrustedSigning"
48+
RUN powershell -Command "\
49+
Invoke-WebRequest -Uri '%TS_URL%' -OutFile '%TS_ZIP%' -ErrorAction Stop ; \
50+
Expand-Archive -Path '%TS_ZIP%' -DestinationPath '%TS_DIR%' -Force ; \
51+
Remove-Item '%TS_ZIP%'"
52+
53+
# Download Windows 11 SDK (10.0.22621.2428) and install only `signtool.exe`
54+
ARG SDK_URL="https://go.microsoft.com/fwlink/?linkid=2250105"
55+
ARG SDK_EXE="C:/windows/temp/winsdksetup.exe"
56+
RUN powershell -Command "\
57+
Invoke-WebRequest -Uri '%SDK_URL%' -OutFile '%SDK_EXE%' -ErrorAction Stop ; \
58+
Start-Process '%SDK_EXE%' -Wait -ArgumentList '/features OptionId.SigningTools', '/q', '/ceip off', '/norestart' ; \
59+
setx /M PATH ('%PATH%;' + (Resolve-Path 'C:/Program Files (x86)/Windows Kits/10/bin/*/x64/')) ; \
60+
Remove-Item '%SDK_EXE%'"
61+
62+
# Install Visual C++ redistributables
63+
RUN powershell -Command "Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 -Force; Set-PSRepository -Name PSGallery -InstallationPolicy Trusted; Install-Module -Name VcRedist -SkipPublisherCheck -Force -ErrorAction Stop"
64+
65+
# Install AWS CLI
66+
RUN msiexec.exe /i "https://awscli.amazonaws.com/AWSCLIV2.msi" /quiet /qn && \
67+
setx /M PATH "%PATH%;C:\Program Files\Amazon\AWSCLIV2"
68+
69+
# Install `TrustedSigning` powershell module
70+
RUN powershell -Command "Install-Module -Name TrustedSigning"
71+
72+
# Set default environment variables and setup useful symlinks
73+
# Note that we add an entry for `buildkite-agent` here despite it not being within
74+
# the image, because we expect it to be mounted within us in the future.
75+
RUN setx /M PATH "C:\buildkite-agent\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%" && \
76+
mklink /J C:\msys64\home\ContainerUser C:\Users\ContainerUser && \
77+
setx /M HOME C:\msys64\home\ContainerUser
78+
WORKDIR C:/home/ContainerUser
79+
80+
# Select the mingw64 environment: https://www.msys2.org/docs/environments/
81+
ENV MSYSTEM=MINGW64
82+
83+
# Default to `bash` for interactive builds
84+
CMD ["bash"]

0 commit comments

Comments
 (0)