From daf9e7d25e1e7d7c0f3dde48329b12a7fc3ae15e Mon Sep 17 00:00:00 2001 From: "Paul \"Hampy\" Hampson" Date: Fri, 27 Aug 2021 13:35:45 +1000 Subject: [PATCH] Add Windows Server 2022 images for 3.9 and 3.10-rc Signed-off-by: Paul "Hampy" Hampson --- .../windowsservercore-ltsc2022/Dockerfile | 82 +++++++++++++++++++ .../windowsservercore-ltsc2022/Dockerfile | 82 +++++++++++++++++++ generate-stackbrew-library.sh | 2 +- update.sh | 2 +- 4 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 3.10-rc/windows/windowsservercore-ltsc2022/Dockerfile create mode 100644 3.9/windows/windowsservercore-ltsc2022/Dockerfile diff --git a/3.10-rc/windows/windowsservercore-ltsc2022/Dockerfile b/3.10-rc/windows/windowsservercore-ltsc2022/Dockerfile new file mode 100644 index 000000000..ca8d55ef0 --- /dev/null +++ b/3.10-rc/windows/windowsservercore-ltsc2022/Dockerfile @@ -0,0 +1,82 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM mcr.microsoft.com/windows/servercore:ltsc2022 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +# https://github.com/docker-library/python/pull/557 +ENV PYTHONIOENCODING UTF-8 + +ENV PYTHON_VERSION 3.10.0rc1 +ENV PYTHON_RELEASE 3.10.0 + +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ + Write-Host ('Downloading {0} ...' -f $url); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3/using/windows.html#installing-without-ui + $exitCode = (Start-Process python.exe -Wait -NoNewWindow -PassThru \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_pip=0', \ + 'Include_test=0' \ + ) \ + ).ExitCode; \ + if ($exitCode -ne 0) { \ + Write-Host ('Running python installer failed with exit code: {0}' -f $exitCode); \ + Get-ChildItem $env:TEMP | Sort-Object -Descending -Property LastWriteTime | Select-Object -First 1 | Get-Content; \ + exit $exitCode; \ + } \ + \ +# the installer updated PATH, so we should refresh our local value + $env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' python --version'; python --version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item python.exe -Force; \ + Remove-Item $env:TEMP/Python*.log -Force; \ + \ + Write-Host 'Complete.' + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 21.2.4 +# https://github.com/pypa/get-pip +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/c20b0cfd643cd4a19246ccf204e2997af70f6b21/public/get-pip.py +ENV PYTHON_GET_PIP_SHA256 fa6f3fb93cce234cd4e8dd2beb54a51ab9c247653b52855a48dd44e6b21ff28b + +RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $env:PYTHON_GET_PIP_URL -OutFile 'get-pip.py'; \ + Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_GET_PIP_SHA256); \ + if ((Get-FileHash 'get-pip.py' -Algorithm sha256).Hash -ne $env:PYTHON_GET_PIP_SHA256) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION); \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + ('pip=={0}' -f $env:PYTHON_PIP_VERSION) \ + ; \ + Remove-Item get-pip.py -Force; \ + \ + Write-Host 'Verifying pip install ...'; \ + pip --version; \ + \ + Write-Host 'Complete.' + +CMD ["python"] diff --git a/3.9/windows/windowsservercore-ltsc2022/Dockerfile b/3.9/windows/windowsservercore-ltsc2022/Dockerfile new file mode 100644 index 000000000..fa9d9d331 --- /dev/null +++ b/3.9/windows/windowsservercore-ltsc2022/Dockerfile @@ -0,0 +1,82 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM mcr.microsoft.com/windows/servercore:ltsc2022 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +# https://github.com/docker-library/python/pull/557 +ENV PYTHONIOENCODING UTF-8 + +ENV PYTHON_VERSION 3.9.6 +ENV PYTHON_RELEASE 3.9.6 + +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ + Write-Host ('Downloading {0} ...' -f $url); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3/using/windows.html#installing-without-ui + $exitCode = (Start-Process python.exe -Wait -NoNewWindow -PassThru \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_pip=0', \ + 'Include_test=0' \ + ) \ + ).ExitCode; \ + if ($exitCode -ne 0) { \ + Write-Host ('Running python installer failed with exit code: {0}' -f $exitCode); \ + Get-ChildItem $env:TEMP | Sort-Object -Descending -Property LastWriteTime | Select-Object -First 1 | Get-Content; \ + exit $exitCode; \ + } \ + \ +# the installer updated PATH, so we should refresh our local value + $env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' python --version'; python --version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item python.exe -Force; \ + Remove-Item $env:TEMP/Python*.log -Force; \ + \ + Write-Host 'Complete.' + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 21.2.4 +# https://github.com/pypa/get-pip +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/c20b0cfd643cd4a19246ccf204e2997af70f6b21/public/get-pip.py +ENV PYTHON_GET_PIP_SHA256 fa6f3fb93cce234cd4e8dd2beb54a51ab9c247653b52855a48dd44e6b21ff28b + +RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $env:PYTHON_GET_PIP_URL -OutFile 'get-pip.py'; \ + Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_GET_PIP_SHA256); \ + if ((Get-FileHash 'get-pip.py' -Algorithm sha256).Hash -ne $env:PYTHON_GET_PIP_SHA256) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION); \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + ('pip=={0}' -f $env:PYTHON_PIP_VERSION) \ + ; \ + Remove-Item get-pip.py -Force; \ + \ + Write-Host 'Verifying pip install ...'; \ + pip --version; \ + \ + Write-Host 'Complete.' + +CMD ["python"] diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 01e367282..94da6f6d6 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -80,7 +80,7 @@ for version in "${versions[@]}"; do for v in \ {bullseye,buster}{,/slim} \ alpine{3.14,3.13} \ - windows/windowsservercore-{1809,ltsc2016} \ + windows/windowsservercore-{ltsc2022,1809,ltsc2016} \ ; do dir="$version/$v" variant="$(basename "$v")" diff --git a/update.sh b/update.sh index 591eb945f..86b19c5a3 100755 --- a/update.sh +++ b/update.sh @@ -134,7 +134,7 @@ for version in "${versions[@]}"; do for v in \ alpine{3.14,3.13} \ {buster,bullseye}{/slim,} \ - windows/windowsservercore-{1809,ltsc2016} \ + windows/windowsservercore-{ltsc2022,1809,ltsc2016} \ ; do dir="$version/$v" variant="$(basename "$v")"