-
Notifications
You must be signed in to change notification settings - Fork 150
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
Separate nanoserver 1809
due to breaking change
#118
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1564a4c
Fix regex to get nanoserver latest tag
TravisEz13 b936628
commit new dockerfiles for 1809
TravisEz13 47145b4
don't build 1809 in old nanoserver image
TravisEz13 d5d5e14
make this script work with the KnownIssues build feature
TravisEz13 3d40e34
fix typos in comments
TravisEz13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# escape=` | ||
# Args used by from statements must be defined here: | ||
ARG fromTag=1709 | ||
ARG WindowsServerCoreVersion=latest | ||
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore | ||
ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver | ||
|
||
# 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 ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env | ||
|
||
# Arguments for installing PowerShell, must be defined in the container they are used | ||
ARG PS_VERSION=6.1.0-rc.1 | ||
|
||
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip | ||
|
||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
RUN 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)} | ||
ADD ${PS_PACKAGE_URL} /powershell.zip | ||
|
||
RUN Expand-Archive powershell.zip -DestinationPath \PowerShell | ||
|
||
# Install PowerShell into NanoServer | ||
FROM ${NanoServerRepo}:${fromTag} | ||
|
||
ARG VCS_REF="none" | ||
ARG PS_VERSION=6.1.0-rc.1 | ||
ARG IMAGE_NAME=mcr.microsoft.com/powershell | ||
|
||
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" ` | ||
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` | ||
description="This Dockerfile will install the latest release of PowerShell." ` | ||
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" ` | ||
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` | ||
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" ` | ||
org.label-schema.name="powershell" ` | ||
org.label-schema.vcs-ref=${VCS_REF} ` | ||
org.label-schema.vendor="PowerShell" ` | ||
org.label-schema.version=${PS_VERSION} ` | ||
org.label-schema.schema-version="1.0" ` | ||
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" ` | ||
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" ` | ||
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" ` | ||
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help" | ||
|
||
# Copy PowerShell Core from the installer container | ||
ENV ProgramFiles C:\Program Files | ||
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] | ||
|
||
# Persist %PSCORE% ENV variable for user convenience | ||
ENV PSCORE="$ProgramFiles\PowerShell\pwsh.exe" | ||
# Set the path | ||
ENV PATH="$PATH;${ProgramFiles}\PowerShell" | ||
|
||
CMD ["pwsh.exe"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
# return objects representing the tags we need to base the nanoserver image on | ||
|
||
|
||
param( | ||
[Switch] | ||
$CI, | ||
# The versions of nanoserver we care about | ||
[string[]] | ||
$ShortTags | ||
) | ||
|
||
$parent = Join-Path -Path $PSScriptRoot -ChildPath '..' | ||
$repoRoot = Join-Path -path (Join-Path -Path $parent -ChildPath '..') -ChildPath '..' | ||
$modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags' | ||
Import-Module $modulePath | ||
|
||
if(!$CI.IsPresent) | ||
{ | ||
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '\d{4}_KB\d{7}(_amd64)?$' -Mcr | ||
} | ||
else { | ||
# This is not supported for nanoserver so don't build in production but try building it as a CI test for the Dockerfile | ||
$shortTags = @('latest') | ||
|
||
# The \d{4,} part of the regex is because the API is returning tags which are 3 digits and older than the 4 digit tags | ||
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '10\.0\.14393\.\d{4,}$' -SkipShortTagFilter -Mcr | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"IsLinux" : false, | ||
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip", | ||
"osVersion": "Nano Server, version ${fromTag}", | ||
"shortTags": [ | ||
{"Tag": "1809"} | ||
], | ||
"tagTemplates": [ | ||
"#psversion#-nanoserver-#tag#", | ||
"preview-nanoserver-#shorttag#" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# escape=` | ||
# Args used by from statements must be defined here: | ||
ARG fromTag=1709 | ||
ARG WindowsServerCoreVersion=latest | ||
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore | ||
ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver | ||
|
||
# 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 ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env | ||
|
||
# Arguments for installing PowerShell, must be defined in the container they are used | ||
ARG PS_VERSION=6.0.4 | ||
|
||
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip | ||
|
||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
RUN 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)} | ||
ADD ${PS_PACKAGE_URL} /powershell.zip | ||
|
||
RUN Expand-Archive powershell.zip -DestinationPath \PowerShell | ||
|
||
# Install PowerShell into NanoServer | ||
FROM ${NanoServerRepo}:${fromTag} | ||
|
||
ARG VCS_REF="none" | ||
ARG PS_VERSION=6.0.4 | ||
ARG IMAGE_NAME=mcr.microsoft.com/powershell | ||
|
||
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" ` | ||
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` | ||
description="This Dockerfile will install the latest release of PowerShell." ` | ||
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" ` | ||
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` | ||
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" ` | ||
org.label-schema.name="powershell" ` | ||
org.label-schema.vcs-ref=${VCS_REF} ` | ||
org.label-schema.vendor="PowerShell" ` | ||
org.label-schema.version=${PS_VERSION} ` | ||
org.label-schema.schema-version="1.0" ` | ||
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" ` | ||
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" ` | ||
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" ` | ||
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help" | ||
|
||
# Copy PowerShell Core from the installer container | ||
ENV ProgramFiles C:\Program Files | ||
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] | ||
|
||
# Persist %PSCORE% ENV variable for user convenience | ||
ENV PSCORE="$ProgramFiles\PowerShell\pwsh.exe" | ||
# Set the path | ||
ENV PATH="$PATH;${ProgramFiles}\PowerShell" | ||
|
||
CMD ["pwsh.exe"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
# return objects representing the tags we need to base the nanoserver image on | ||
|
||
|
||
param( | ||
[Switch] | ||
$CI, | ||
# The versions of nanoserver we care about | ||
[string[]] | ||
$ShortTags | ||
) | ||
|
||
$parent = Join-Path -Path $PSScriptRoot -ChildPath '..' | ||
$repoRoot = Join-Path -path (Join-Path -Path $parent -ChildPath '..') -ChildPath '..' | ||
$modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags' | ||
Import-Module $modulePath | ||
|
||
if(!$CI.IsPresent) | ||
{ | ||
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '\d{4}_KB\d{7}(_amd64)?$' -Mcr | ||
} | ||
else { | ||
# This is not supported for nanoserver so don't build in production but try building it as a CI test for the Dockerfile | ||
$shortTags = @('latest') | ||
|
||
# The \d{4,} part of the regex is because the API is returning tags which are 3 digits and older than the 4 digit tags | ||
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '10\.0\.14393\.\d{4,}$' -SkipShortTagFilter -Mcr | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"IsLinux" : false, | ||
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip", | ||
"osVersion": "Nano Server, version ${fromTag}", | ||
"shortTags": [ | ||
{"Tag": "1809"} | ||
], | ||
"tagTemplates": [ | ||
"#psversion#-nanoserver-#tag#" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# escape=` | ||
# Args used by from statements must be defined here: | ||
ARG fromTag=1709 | ||
ARG WindowsServerCoreVersion=latest | ||
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore | ||
ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver | ||
|
||
# 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 ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env | ||
|
||
# Arguments for installing PowerShell, must be defined in the container they are used | ||
ARG PS_VERSION=6.1.0 | ||
|
||
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip | ||
|
||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
RUN 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)} | ||
ADD ${PS_PACKAGE_URL} /powershell.zip | ||
|
||
RUN Expand-Archive powershell.zip -DestinationPath \PowerShell | ||
|
||
# Install PowerShell into NanoServer | ||
FROM ${NanoServerRepo}:${fromTag} | ||
|
||
ARG VCS_REF="none" | ||
ARG PS_VERSION=6.1.0 | ||
ARG IMAGE_NAME=mcr.microsoft.com/powershell | ||
|
||
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" ` | ||
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` | ||
description="This Dockerfile will install the latest release of PowerShell." ` | ||
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" ` | ||
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` | ||
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" ` | ||
org.label-schema.name="powershell" ` | ||
org.label-schema.vcs-ref=${VCS_REF} ` | ||
org.label-schema.vendor="PowerShell" ` | ||
org.label-schema.version=${PS_VERSION} ` | ||
org.label-schema.schema-version="1.0" ` | ||
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" ` | ||
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" ` | ||
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" ` | ||
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help" | ||
|
||
# Copy PowerShell Core from the installer container | ||
ENV ProgramFiles C:\Program Files | ||
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] | ||
|
||
# Persist %PSCORE% ENV variable for user convenience | ||
ENV PSCORE="$ProgramFiles\PowerShell\pwsh.exe" | ||
# Set the path | ||
ENV PATH="$PATH;${ProgramFiles}\PowerShell" | ||
|
||
CMD ["pwsh.exe"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you make sure
fromTag
andWindowsServerCoreVersion
are based the same os version (eg, ltsc2019)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't need to be. So I don't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latest
is supposed to be amanifestlist
that works on the current platform. So, I used that. But, after they moved to mcr, it's no longer amanifestlist
. I deal with the problem of incompatible kernels if I ever hit it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks.