Skip to content

Commit e67413b

Browse files
authored
Use the PowerShell Nanoserver image to build nanoserver (#218)
1 parent 27b0c59 commit e67413b

File tree

7 files changed

+45
-39
lines changed

7 files changed

+45
-39
lines changed

release/preview/nanoserver/docker/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# escape=`
22
# Args used by from statements must be defined here:
33
ARG 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
66
ARG 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
1313
ARG PS_VERSION=6.1.0-rc.1
1414

1515
ARG 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

1919
ARG 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 \PowerShell
35+
New-Item -ItemType Directory /installer > $null ; `
36+
Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
37+
Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell
3738

3839
# Install PowerShell into NanoServer
3940
FROM ${NanoServerRepo}:${fromTag}

release/preview/nanoserver1809/docker/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# escape=`
22
# Args used by from statements must be defined here:
33
ARG 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
66
ARG 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
1313
ARG PS_VERSION=6.2.0-rc.1
1414

1515
ARG 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

1919
ARG 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 \PowerShell
35+
New-Item -ItemType Directory /installer > $null ; `
36+
Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
37+
Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell
3738

3839
# Install PowerShell into NanoServer
3940
FROM ${NanoServerRepo}:${fromTag}

release/servicing/nanoserver/docker/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# escape=`
22
# Args used by from statements must be defined here:
33
ARG 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
66
ARG 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
1313
ARG PS_VERSION=6.1.0
1414

1515
ARG 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

1919
ARG 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 \PowerShell
35+
New-Item -ItemType Directory /installer > $null ; `
36+
Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
37+
Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell
3738

3839
# Install PowerShell into NanoServer
3940
FROM ${NanoServerRepo}:${fromTag}

release/servicing/nanoserver1809/docker/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# escape=`
22
# Args used by from statements must be defined here:
33
ARG 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
66
ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver
77

88
# Use server core as an installer container to extract PowerShell,
@@ -14,7 +14,7 @@ ARG PS_VERSION=6.1.0
1414

1515
ARG 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

1919
ARG 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 \PowerShell
35+
New-Item -ItemType Directory /installer > $null ; `
36+
Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
37+
Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell
3738

3839
# Install PowerShell into NanoServer
3940
FROM ${NanoServerRepo}:${fromTag}

release/stable/nanoserver/docker/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# escape=`
22
# Args used by from statements must be defined here:
33
ARG 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
66
ARG 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
1313
ARG PS_VERSION=6.2.0
1414

1515
ARG 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

1919
ARG 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 \PowerShell
35+
New-Item -ItemType Directory /installer > $null ; `
36+
Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
37+
Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell
3738

3839
# Install PowerShell into NanoServer
3940
FROM ${NanoServerRepo}:${fromTag}

release/stable/nanoserver1809/docker/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# escape=`
22
# Args used by from statements must be defined here:
33
ARG 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
66
ARG 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
1313
ARG PS_VERSION=6.2.0
1414

1515
ARG 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

1919
ARG 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 \PowerShell
35+
New-Item -ItemType Directory /installer > $null ; `
36+
Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; `
37+
Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell
3738

3839
# Install PowerShell into NanoServer
3940
FROM ${NanoServerRepo}:${fromTag}

vsts-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ jobs:
140140
# Skipping previews on windows due to how long it takes to build on windows
141141
- template: .vsts-ci/phase.yml
142142
parameters:
143-
name: nanoserver_ltsc_2016
144-
imagename: nanoserver
145-
vmImage: vs2017-win2016
143+
name: nanoserver_1809
144+
imagename: nanoserver1809
145+
vmImage: windows-2019
146146
preview: false
147147
ciParameter: '-CI'
148-
continueonerror: true
148+
continueonerror: false
149149

150150
# Use the TagFilter to filter to 1809 because the docker instance inside the agent only supports 1809
151151
- template: .vsts-ci/phase.yml

0 commit comments

Comments
 (0)