From 678ce739076d67e191eaf7f8876bc55e835efdfc Mon Sep 17 00:00:00 2001 From: Kevin Alvarez Date: Fri, 18 Aug 2023 10:18:52 +0200 Subject: [PATCH] windows: update default base image for dev container Signed-off-by: CrazyMax --- .github/workflows/.windows.yml | 18 ++++++++++++------ Dockerfile.windows | 10 +++------- testutil/environment/environment.go | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/.windows.yml b/.github/workflows/.windows.yml index 5e8736e34d..5392a5a854 100644 --- a/.github/workflows/.windows.yml +++ b/.github/workflows/.windows.yml @@ -75,9 +75,12 @@ jobs: - name: Build base image run: | - docker pull ${{ env.WINDOWS_BASE_IMAGE }}:${{ env.WINDOWS_BASE_IMAGE_TAG }} - docker tag ${{ env.WINDOWS_BASE_IMAGE }}:${{ env.WINDOWS_BASE_IMAGE_TAG }} microsoft/windowsservercore - docker build --build-arg GO_VERSION -t ${{ env.TEST_IMAGE_NAME }} -f Dockerfile.windows . + & docker build ` + --build-arg WINDOWS_BASE_IMAGE ` + --build-arg WINDOWS_BASE_IMAGE_TAG ` + --build-arg GO_VERSION ` + -t ${{ env.TEST_IMAGE_NAME }} ` + -f Dockerfile.windows . - name: Build binaries run: | @@ -152,9 +155,12 @@ jobs: - name: Build base image run: | - docker pull ${{ env.WINDOWS_BASE_IMAGE }}:${{ env.WINDOWS_BASE_IMAGE_TAG }} - docker tag ${{ env.WINDOWS_BASE_IMAGE }}:${{ env.WINDOWS_BASE_IMAGE_TAG }} microsoft/windowsservercore - docker build --build-arg GO_VERSION -t ${{ env.TEST_IMAGE_NAME }} -f Dockerfile.windows . + & docker build ` + --build-arg WINDOWS_BASE_IMAGE ` + --build-arg WINDOWS_BASE_IMAGE_TAG ` + --build-arg GO_VERSION ` + -t ${{ env.TEST_IMAGE_NAME }} ` + -f Dockerfile.windows . - name: Test run: | diff --git a/Dockerfile.windows b/Dockerfile.windows index d3783a9331..93669e698d 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -154,13 +154,9 @@ # The number of build steps below are explicitly minimised to improve performance. -# Extremely important - do not change the following line to reference a "specific" image, -# such as `mcr.microsoft.com/windows/servercore:ltsc2022`. If using this Dockerfile in process -# isolated containers, the kernel of the host must match the container image, and hence -# would fail between Windows Server 2016 (aka RS1) and Windows Server 2019 (aka RS5). -# It is expected that the image `microsoft/windowsservercore:latest` is present, and matches -# the hosts kernel version before doing a build. -FROM microsoft/windowsservercore +ARG WINDOWS_BASE_IMAGE=mcr.microsoft.com/windows/servercore +ARG WINDOWS_BASE_IMAGE_TAG=ltsc2022 +FROM ${WINDOWS_BASE_IMAGE}:${WINDOWS_BASE_IMAGE_TAG} # Use PowerShell as the default shell SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] diff --git a/testutil/environment/environment.go b/testutil/environment/environment.go index bef9b58357..720504b1d2 100644 --- a/testutil/environment/environment.go +++ b/testutil/environment/environment.go @@ -70,7 +70,7 @@ func getPlatformDefaults(info system.Info) PlatformDefaults { ContainerStoragePath: toSlash(containersPath), } case "windows": - baseImage := "microsoft/windowsservercore" + baseImage := "mcr.microsoft.com/windows/servercore:ltsc2022" if overrideBaseImage := os.Getenv("WINDOWS_BASE_IMAGE"); overrideBaseImage != "" { baseImage = overrideBaseImage if overrideBaseImageTag := os.Getenv("WINDOWS_BASE_IMAGE_TAG"); overrideBaseImageTag != "" {