Skip to content

Commit

Permalink
ci: Install cygwin on our Docker container
Browse files Browse the repository at this point in the history
We install cygwin exactly as Kokoro does on their own containers.
  • Loading branch information
amanda-tarafa committed Sep 30, 2024
1 parent 301caa8 commit 9b7ac21
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .kokoro/gcp_windows_docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# We build in .NET 6 so we need to install .NET 6 after.
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019

# Setup Powershell
RUN powershell -Command $ErrorActionPreference = 'Stop';
RUN powershell -Command $ProgressPreference = 'SilentlyContinue';
# Set default powershell policy for this script (ProgressPreference='SilentlyContinue' makes
# downloads with Invoke-WebRequest not show the progress bar and is MUCH faster).
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command", "$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; $VerbosePreference = 'Continue';"]

# Install Chocolatey
ENV ChocolateyUseWindowsCompression false
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); \
$old_path = [Environment]::GetEnvironmentVariable(\"PATH\", \"Machine\"); \
$all_users_profile = [Environment]::GetEnvironmentVariable(\"ALLUSERSPROFILE\", \"Machine\"); \
[Environment]::SetEnvironmentVariable(\"PATH\", $old_path + \";\" + $all_users_profile + \"\chocolatey\bin\", \"Machine\");

# Install .NET Core 3.0 which we need for Google.Apis.Auth.AspNetCore3
RUN choco install -y --no-progress dotnetcore-3.0-sdk
Expand All @@ -22,6 +25,16 @@ RUN choco install -y --no-progress dotnet-6.0-sdk
# Install Git
RUN choco install -y --no-progress git

# Install cygwin and packages exactly as Kokoro does on its own containers
RUN Invoke-WebRequest 'https://cygwin.com/setup-x86_64.exe' -OutFile C:/cygwin_setup.exe -UseBasicParsing; \
Start-Process 'C:/cygwin_setup.exe' -ArgumentList '-X', '--quiet-mode', '--root', 'C:\Cygwin64', '--site', 'http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/2022/11/23/063529' -Wait -NoNewWindow; \
Remove-Item C:/cygwin_setup.exe; \
$old_path = [Environment]::GetEnvironmentVariable(\"PATH\", \"Machine\"); \
[Environment]::SetEnvironmentVariable(\"PATH\", $old_path + \";C:\Cygwin64\bin\", \"Machine\");

# Restore default shell for Windows containers.
SHELL ["cmd.exe", "/s", "/c"]

# Default to PowerShell.
# This is what Kokoro owned Docker images do. We'll do the same at least for now.
CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

0 comments on commit 9b7ac21

Please sign in to comment.