Skip to content

Create 2022 server image #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions release/lts/windowsserver2022/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# escape=`
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

ARG dockerHost=mcr.microsoft.com
ARG WindowsServerRepo=windows/server
ARG tag=ltsc2022

# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM mcr.microsoft.com/${WindowsServerRepo}:${tag} AS installer-env

ARG PS_VERSION=6.2.0
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip

SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]

ARG PS_PACKAGE_URL_BASE64

RUN Write-host "Verifying valid Version..."; `
if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) { `
throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION) `
} `
$ProgressPreference = 'SilentlyContinue'; `
if($env:PS_PACKAGE_URL_BASE64){ `
Write-host "decoding: $env:PS_PACKAGE_URL_BASE64" ;`
$url = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($env:PS_PACKAGE_URL_BASE64)) `
} else { `
Write-host "using url: $env:PS_PACKAGE_URL" ;`
$url = $env:PS_PACKAGE_URL `
} `
Write-host "downloading: $url"; `
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest -Uri $url -outfile /powershell.zip -verbose; `
Expand-Archive powershell.zip -DestinationPath \PowerShell

# Install PowerShell into WindowsServer
FROM mcr.microsoft.com/${WindowsServerRepo}:${tag}

# Copy PowerShell Core from the installer container
ENV ProgramFiles="C:\Program Files" `
# set a fixed location for the Module analysis cache
PSModuleAnalysisCachePath="C:\Users\Public\AppData\Local\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" `
# Persist %PSCORE% ENV variable for user convenience
PSCORE="$ProgramFiles\PowerShell\pwsh.exe" `
POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-WindowsServer-ltsc2022" `
POWERSHELL_TELEMETRY_OPTOUT="1"

# Copy PowerShell Core from the installer container
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell\\latest"]

# Set the path
RUN setx /M PATH "%ProgramFiles%\PowerShell\latest;%PATH%;"

# intialize powershell module cache
RUN pwsh `
-NoLogo `
-NoProfile `
-Command " `
$stopTime = (get-date).AddMinutes(15); `
$ErrorActionPreference = 'Stop' ; `
$ProgressPreference = 'SilentlyContinue' ; `
while(!(Test-Path -Path $env:PSModuleAnalysisCachePath)) { `
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; `
if((get-date) -gt $stopTime) { throw 'timout expired'} `
Start-Sleep -Seconds 6 ; `
}"

# re-enable telemetry
ENV POWERSHELL_TELEMETRY_OPTOUT="0"

CMD ["pwsh.exe"]
23 changes: 23 additions & 0 deletions release/lts/windowsserver2022/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"IsLinux": false,
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip",
"osVersion": "Windows Server, LTSC 2022",
"shortTags": [
{
"Tag": "ltsc2022"
}
],
"Base64EncodePackageUrl": true,
"tagTemplates": [
"lts-#psversion#-windowsserver-#shorttag#",
"lts-windowsserver-#shorttag#",
"lts-windowsserver-#shorttag#-#fulltag#"
],
"manifestLists": [
"lts"
],
"TestProperties": {
"size": 1
},
"UseAcr": true
}
72 changes: 72 additions & 0 deletions release/preview/windowsserver2022/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# escape=`
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

ARG dockerHost=mcr.microsoft.com
ARG WindowsServerRepo=windows/server
ARG tag=ltsc2022

# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM mcr.microsoft.com/${WindowsServerRepo}:${tag} AS installer-env

ARG PS_VERSION=6.2.0
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip

SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]

ARG PS_PACKAGE_URL_BASE64

RUN Write-host "Verifying valid Version..."; `
if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) { `
throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION) `
} `
$ProgressPreference = 'SilentlyContinue'; `
if($env:PS_PACKAGE_URL_BASE64){ `
Write-host "decoding: $env:PS_PACKAGE_URL_BASE64" ;`
$url = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($env:PS_PACKAGE_URL_BASE64)) `
} else { `
Write-host "using url: $env:PS_PACKAGE_URL" ;`
$url = $env:PS_PACKAGE_URL `
} `
Write-host "downloading: $url"; `
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest -Uri $url -outfile /powershell.zip -verbose; `
Expand-Archive powershell.zip -DestinationPath \PowerShell

# Install PowerShell into WindowsServer
FROM mcr.microsoft.com/${WindowsServerRepo}:${tag}

# Copy PowerShell Core from the installer container
ENV ProgramFiles="C:\Program Files" `
# set a fixed location for the Module analysis cache
PSModuleAnalysisCachePath="C:\Users\Public\AppData\Local\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" `
# Persist %PSCORE% ENV variable for user convenience
PSCORE="$ProgramFiles\PowerShell\pwsh.exe" `
POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-WindowsServer-ltsc2022" `
POWERSHELL_TELEMETRY_OPTOUT="1"

# Copy PowerShell Core from the installer container
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell\\latest"]

# Set the path
RUN setx /M PATH "%ProgramFiles%\PowerShell\latest;%PATH%;"

# intialize powershell module cache
RUN pwsh `
-NoLogo `
-NoProfile `
-Command " `
$stopTime = (get-date).AddMinutes(15); `
$ErrorActionPreference = 'Stop' ; `
$ProgressPreference = 'SilentlyContinue' ; `
while(!(Test-Path -Path $env:PSModuleAnalysisCachePath)) { `
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; `
if((get-date) -gt $stopTime) { throw 'timout expired'} `
Start-Sleep -Seconds 6 ; `
}"

# re-enable telemetry
ENV POWERSHELL_TELEMETRY_OPTOUT="0"

CMD ["pwsh.exe"]
23 changes: 23 additions & 0 deletions release/preview/windowsserver2022/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"IsLinux": false,
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip",
"osVersion": "Windows Server, LTSC 2022",
"shortTags": [
{
"Tag": "ltsc2022"
}
],
"Base64EncodePackageUrl": true,
"tagTemplates": [
"#psversion#-windowsserver-#shorttag#",
"#psversion#-windowsserver-#shorttag#-#fulltag#",
"preview-windowsserver-#shorttag#"
],
"manifestLists": [
"preview-windowsserver"
],
"TestProperties": {
"size": 1
},
"UseAcr": true
}
72 changes: 72 additions & 0 deletions release/stable/windowsserver2022/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# escape=`
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

ARG dockerHost=mcr.microsoft.com
ARG WindowsServerRepo=windows/server
ARG tag=ltsc2022

# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM mcr.microsoft.com/${WindowsServerRepo}:${tag} AS installer-env

ARG PS_VERSION=6.2.0
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip

SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]

ARG PS_PACKAGE_URL_BASE64

RUN Write-host "Verifying valid Version..."; `
if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) { `
throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION) `
} `
$ProgressPreference = 'SilentlyContinue'; `
if($env:PS_PACKAGE_URL_BASE64){ `
Write-host "decoding: $env:PS_PACKAGE_URL_BASE64" ;`
$url = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($env:PS_PACKAGE_URL_BASE64)) `
} else { `
Write-host "using url: $env:PS_PACKAGE_URL" ;`
$url = $env:PS_PACKAGE_URL `
} `
Write-host "downloading: $url"; `
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest -Uri $url -outfile /powershell.zip -verbose; `
Expand-Archive powershell.zip -DestinationPath \PowerShell

# Install PowerShell into WindowsServer
FROM mcr.microsoft.com/${WindowsServerRepo}:${tag}

# Copy PowerShell Core from the installer container
ENV ProgramFiles="C:\Program Files" `
# set a fixed location for the Module analysis cache
PSModuleAnalysisCachePath="C:\Users\Public\AppData\Local\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" `
# Persist %PSCORE% ENV variable for user convenience
PSCORE="$ProgramFiles\PowerShell\pwsh.exe" `
POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-WindowsServer-ltsc2022" `
POWERSHELL_TELEMETRY_OPTOUT="1"

# Copy PowerShell Core from the installer container
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell\\latest"]

# Set the path
RUN setx /M PATH "%ProgramFiles%\PowerShell\latest;%PATH%;"

# intialize powershell module cache
RUN pwsh `
-NoLogo `
-NoProfile `
-Command " `
$stopTime = (get-date).AddMinutes(15); `
$ErrorActionPreference = 'Stop' ; `
$ProgressPreference = 'SilentlyContinue' ; `
while(!(Test-Path -Path $env:PSModuleAnalysisCachePath)) { `
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; `
if((get-date) -gt $stopTime) { throw 'timout expired'} `
Start-Sleep -Seconds 6 ; `
}"

# re-enable telemetry
ENV POWERSHELL_TELEMETRY_OPTOUT="0"

CMD ["pwsh.exe"]
23 changes: 23 additions & 0 deletions release/stable/windowsserver2022/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"IsLinux": false,
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip",
"osVersion": "Windows Server, LTSC 2022",
"shortTags": [
{
"Tag": "ltsc2022"
}
],
"Base64EncodePackageUrl": true,
"tagTemplates": [
"#psversion#-windowsserver-#shorttag#",
"#psversion#-windowsserver-#shorttag#-#fulltag#",
"windowsserver-#shorttag#"
],
"manifestLists": [
"windowsserver"
],
"TestProperties": {
"size": 1
},
"UseAcr": true
}