Skip to content

Commit

Permalink
fix: pin windowsservercore-ltsc2019 to April 2024 release
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve committed Jun 23, 2024
1 parent d1bfd81 commit a309788
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
13 changes: 13 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ function "toolsversion" {
: version)
}

# Return the Windows version digest to use for windowsservercore ltsc2019 image
# TODO: workaround, to be removed when https://github.com/microsoft/Windows-Containers/issues/493 is resolved
function "windowsversiondigest" {
params = [version]
result = (equal("ltsc2019", version)
? "@sha256:6fdf140282a2f809dae9b13fe441635867f0a27c33a438771673b8da8f3348a4"
: "")
}

target "alpine" {
matrix = {
jdk = jdks_to_build
Expand Down Expand Up @@ -208,6 +217,8 @@ target "nanoserver" {
JAVA_HOME = "C:/openjdk-${jdk}"
JAVA_VERSION = "${replace(javaversion(jdk), "_", "+")}"
TOOLS_WINDOWS_VERSION = "${toolsversion(windows_version)}"
# TODO: workaround, to be removed when https://github.com/microsoft/Windows-Containers/issues/493 is resolved
WINDOWS_VERSION_DIGEST = windowsversiondigest(windows_version)
WINDOWS_VERSION_TAG = windows_version
}
tags = [
Expand All @@ -233,6 +244,8 @@ target "windowsservercore" {
JAVA_HOME = "C:/openjdk-${jdk}"
JAVA_VERSION = "${replace(javaversion(jdk), "_", "+")}"
TOOLS_WINDOWS_VERSION = "${toolsversion(windows_version)}"
# TODO: workaround, to be removed when https://github.com/microsoft/Windows-Containers/issues/493 is resolved
WINDOWS_VERSION_DIGEST = windowsversiondigest(windows_version)
WINDOWS_VERSION_TAG = windows_version
}
tags = [
Expand Down
4 changes: 3 additions & 1 deletion windows/nanoserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

ARG WINDOWS_VERSION_TAG
ARG TOOLS_WINDOWS_VERSION
FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}" AS jdk-core
# TODO: workaround, to be removed when https://github.com/microsoft/Windows-Containers/issues/493 is resolved
ARG WINDOWS_VERSION_DIGEST # Empty by default
FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}${WINDOWS_VERSION_DIGEST}" AS jdk-core

# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
Expand Down
6 changes: 4 additions & 2 deletions windows/windowsservercore/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

ARG WINDOWS_VERSION_TAG
ARG TOOLS_WINDOWS_VERSION
FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}" AS jdk-core
# TODO: workaround, to be removed when https://github.com/microsoft/Windows-Containers/issues/493 is resolved
ARG WINDOWS_VERSION_DIGEST # Empty by default
FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}${WINDOWS_VERSION_DIGEST}" AS jdk-core

# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
Expand All @@ -38,7 +40,7 @@ RUN New-Item -ItemType Directory -Path C:\temp | Out-Null ; `
$proc.WaitForExit() ; `
Remove-Item -Path C:\temp -Recurse | Out-Null

FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}"
FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}${WINDOWS_VERSION_DIGEST}"

ARG JAVA_HOME
ENV JAVA_HOME=${JAVA_HOME}
Expand Down

0 comments on commit a309788

Please sign in to comment.