From 0392c3350783277134eb2afe4822b5f6e561a565 Mon Sep 17 00:00:00 2001 From: James Ruskin Date: Sun, 12 Feb 2023 15:04:43 +0000 Subject: [PATCH] (#3020) Uses the Dotnet Image as the basis for the Windows image This should fix the Docker Windows for Chocolatey 2.0+, which is currently failing due to the inability to install 4.8 during the Docker steps. On top of this, the Arg has been misbehaving with Amazon's version of Docker. As we only intend to build the 2016 LTSC version at the moment, I have removed this until the issue is solved. --- docker/Dockerfile.windows | 5 ++--- docker/README.md | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows index df9d6fbf80..ef754ea193 100644 --- a/docker/Dockerfile.windows +++ b/docker/Dockerfile.windows @@ -1,5 +1,4 @@ -ARG tagversion="ltsc2016" -FROM mcr.microsoft.com/windows/servercore:${tagversion} +FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2016 LABEL org.opencontainers.image.url="https://chocolatey.org/" LABEL org.opencontainers.image.documentation="https://docs.chocolatey.org/" @@ -9,7 +8,7 @@ LABEL org.opencontainers.image.licenses="Apache-2.0" LABEL org.opencontainers.image.title="Chocolatey" LABEL org.opencontainers.image.description="Chocolatey Client running on .NET" LABEL org.opencontainers.image.authors="https://chocolatey.org/support" -LABEL org.opencontainers.image.base.name="mcr.microsoft.com/windows/servercore:${tagversion}" +LABEL org.opencontainers.image.base.name="mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2016" COPY ./code_drop/Packages/Chocolatey C:/choco-nupkg COPY ./docker/Install-ChocolateyInContainer.ps1 C:/choco-nupkg/Install-ChocolateyInContainer.ps1 diff --git a/docker/README.md b/docker/README.md index 72f75d425b..8b5d091a38 100644 --- a/docker/README.md +++ b/docker/README.md @@ -10,7 +10,6 @@ To build the Windows image yourself, follow these steps: 1. Either build choco on the host or put a pre-built chocolatey `.nupkg` in `.\code_drop\Packages\Chocolatey`. * See the README at the root of the repository for instructions on how to build choco. 1. Run the docker build command. `docker build -t choco:latest-windows -f docker/Dockerfile.windows .` (the trailing . is important) - * To change the version of the servercore image used, add the argument `--build-arg tagversion=servercore-tag` * To build a official version, put an official `.nupkg` in `.\code_drop\Packages\Chocolatey` and change the image name to `chocolatey/choco:latest-windows` * If you get messages similar to "Can't add file x to tar: archive/tar: missed writing 794 bytes", make sure Visual Studio is closed. 1. Run your new image using the command `docker run -ti --rm choco:latest-windows cmd.exe`