Skip to content

Instantly share code, notes, and snippets.

@pbering
Last active September 30, 2023 13:59
Show Gist options
  • Save pbering/06713a0b44c917fa5f40d0ceec28c127 to your computer and use it in GitHub Desktop.
Save pbering/06713a0b44c917fa5f40d0ceec28c127 to your computer and use it in GitHub Desktop.
param (
[Parameter(Mandatory = $false)]
[string]$Platform = "ltsc2019"
)
$platformToNanoSeverMapping = @{
"ltsc2019" = "1809";
"ltsc2022" = "ltsc2022"
}
$nanoserver = $platformToNanoSeverMapping[$Platform]
# add common tags
$tags = @(
"mcr.microsoft.com/windows/servercore:$Platform",
"mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-$Platform",
"mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-$Platform",
"mcr.microsoft.com/dotnet/runtime:6.0-windowsservercore-$Platform",
"mcr.microsoft.com/dotnet/runtime:7.0-windowsservercore-$Platform",
"mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-$Platform",
"mcr.microsoft.com/dotnet/sdk:7.0-windowsservercore-$Platform"
)
# Sitecore namespaces to include
$namespaces = @(
"sxp",
"sxp/nonproduction",
"sxp/modules",
"tools"
)
# add Sitecore tags
if ($null -eq $source)
{
$source = Invoke-RestMethod "https://raw.githubusercontent.com/Sitecore/docker-images/master/tags/sitecore-tags.json"
}
$source | Where-Object { $namespaces -contains $_.Namespace } | ForEach-Object {
$image = $_
$image.tags | Where-Object { ($_.TargetOS -eq $Platform -or $_.TargetOS -eq $nanoserver) -and $_.Tag -match "^\d+\.\d+\.\d+-\w+$" } | Sort-Object -Property Tag | ForEach-Object {
$tag = $_
$tags += ("scr.sitecore.com/{0}:{1}" -f $image.Name, $tag.Tag)
}
}
$tags | Write-Output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment