Skip to content

Commit

Permalink
Replace gzip with pigz for Windows docker extraction (#337)
Browse files Browse the repository at this point in the history
* Replace gzip with pigz for Windows docker extraction

Signed-off-by: Peter Zhu <[email protected]>

* More tweaks

Signed-off-by: Peter Zhu <[email protected]>

* More tweaks

Signed-off-by: Peter Zhu <[email protected]>

* More tweaks

Signed-off-by: Peter Zhu <[email protected]>

---------

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Aug 25, 2023
1 parent 066a7cf commit 7d72e4a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packer/scripts/windows/scoop-install-commons-docker-support.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ aws --version
# Install zip
scoop install zip

# Replace gzip with pigz/unpigz for docker extration
# The pigz binary on the Windows OS is from this PR: https://github.com/kubernetes/kubernetes/pull/96470
# It seems like pigz/unpigz can only be detect by docker if it is in [System.EnvironmentVariableTarget]::Machine env vars
# Per this PR it uses LookPath: https://github.com/moby/moby/pull/35697, which checks the system path here: https://pkg.go.dev/v.io/x/lib/lookpath
Set-MpPreference -DisableRealtimeMonitoring $true
$pigzPath = "C:\pigz"
mkdir $pigzPath
curl.exe -SL "https://ci.opensearch.org/ci/dbc/tools/pigz-2.3.1-20201104-134221-gke-release-windows.zip" -o "$pigzPath\\pigz.zip"
unzip "$pigzPath\\pigz.zip" -d $pigzPath
rm -v "$pigzPath\\*.zip"
$machineenv = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable("PATH", $machineenv + ";$pigzPath", [System.EnvironmentVariableTarget]::Machine)

# Setup Docker
echo "Enable Hyper-V"
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V" -All -NoRestart
Expand Down

0 comments on commit 7d72e4a

Please sign in to comment.