11# escape=`
22# Args used by from statements must be defined here:
33ARG fromTag=1709
4- ARG WindowsServerCoreVersion=latest
5- ARG WindowsServerCoreRepo =mcr.microsoft.com/windows/servercore
4+ ARG InstallerVersion=nanoserver
5+ ARG InstallerRepo =mcr.microsoft.com/powershell
66ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver
77
88# Use server core as an installer container to extract PowerShell,
99# As this is a multi-stage build, this stage will eventually be thrown away
10- FROM ${WindowsServerCoreRepo }:$WindowsServerCoreVersion AS installer-env
10+ FROM ${InstallerRepo }:$InstallerVersion AS installer-env
1111
1212# Arguments for installing PowerShell, must be defined in the container they are used
1313ARG PS_VERSION=6.1.0-rc.1
1414
1515ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip
1616
17- SHELL ["powershell " , "-Command" , "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';" ]
17+ SHELL ["pwsh " , "-Command" , "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';" ]
1818
1919ARG PS_PACKAGE_URL_BASE64
2020
@@ -32,8 +32,9 @@ RUN Write-host "Verifying valid Version..."; `
3232 } `
3333 Write-host "downloading: $url" ; `
3434 [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; `
35- Invoke-WebRequest -Uri $url -outfile /powershell.zip -verbose; `
36- Expand-Archive powershell.zip -DestinationPath \P owerShell
35+ New-Item -ItemType Directory /installer > $null ; `
36+ Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
37+ Expand-Archive /installer/powershell.zip -DestinationPath \P owerShell
3738
3839# Install PowerShell into NanoServer
3940FROM ${NanoServerRepo}:${fromTag}
0 commit comments