From ce648832b041293fa3542af884ac5a44a67354d3 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 22 Nov 2017 15:01:35 -0800 Subject: [PATCH] Add explicit support for Windows Server 1709 --- .appveyor.yml | 8 +-- .../Dockerfile | 2 +- .../windowsservercore-ltsc2016/Dockerfile | 57 +++++++++++++++++ .../Dockerfile | 2 +- .../windowsservercore-ltsc2016/Dockerfile | 61 +++++++++++++++++++ .../Dockerfile | 2 +- .../windowsservercore-ltsc2016/Dockerfile | 61 +++++++++++++++++++ .../Dockerfile | 2 +- .../windowsservercore-ltsc2016/Dockerfile | 61 +++++++++++++++++++ Dockerfile-windowsservercore.template | 2 +- generate-stackbrew-library.sh | 18 +++++- update.sh | 9 ++- 12 files changed, 270 insertions(+), 15 deletions(-) rename 2.7/windows/{windowsservercore => windowsservercore-1709}/Dockerfile (97%) create mode 100644 2.7/windows/windowsservercore-ltsc2016/Dockerfile rename 3.5/windows/{windowsservercore => windowsservercore-1709}/Dockerfile (97%) create mode 100644 3.5/windows/windowsservercore-ltsc2016/Dockerfile rename 3.6/windows/{windowsservercore => windowsservercore-1709}/Dockerfile (97%) create mode 100644 3.6/windows/windowsservercore-ltsc2016/Dockerfile rename 3.7-rc/windows/{windowsservercore => windowsservercore-1709}/Dockerfile (97%) create mode 100644 3.7-rc/windows/windowsservercore-ltsc2016/Dockerfile diff --git a/.appveyor.yml b/.appveyor.yml index 781b03f8e..9419a1823 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,13 +4,13 @@ image: Visual Studio 2017 environment: matrix: - version: 3.7-rc - variant: windowsservercore + variant: windowsservercore-ltsc2016 - version: 3.6 - variant: windowsservercore + variant: windowsservercore-ltsc2016 - version: 3.5 - variant: windowsservercore + variant: windowsservercore-ltsc2016 - version: 2.7 - variant: windowsservercore + variant: windowsservercore-ltsc2016 install: - ps: | diff --git a/2.7/windows/windowsservercore/Dockerfile b/2.7/windows/windowsservercore-1709/Dockerfile similarity index 97% rename from 2.7/windows/windowsservercore/Dockerfile rename to 2.7/windows/windowsservercore-1709/Dockerfile index 205d4741f..ef81fe2ad 100644 --- a/2.7/windows/windowsservercore/Dockerfile +++ b/2.7/windows/windowsservercore-1709/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore +FROM microsoft/windowsservercore:1709 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] diff --git a/2.7/windows/windowsservercore-ltsc2016/Dockerfile b/2.7/windows/windowsservercore-ltsc2016/Dockerfile new file mode 100644 index 000000000..38835fdb5 --- /dev/null +++ b/2.7/windows/windowsservercore-ltsc2016/Dockerfile @@ -0,0 +1,57 @@ +FROM microsoft/windowsservercore:ltsc2016 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV PYTHON_VERSION 2.7.14 +ENV PYTHON_RELEASE 2.7.14 + +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}.amd64.msi' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ + Write-Host ('Downloading {0} ...' -f $url); \ + Invoke-WebRequest -Uri $url -OutFile 'python.msi'; \ + \ + Write-Host 'Installing ...'; \ +# https://www.python.org/download/releases/2.4/msi/ + Start-Process msiexec -Wait \ + -ArgumentList @( \ + '/i', \ + 'python.msi', \ + '/quiet', \ + '/qn', \ + 'TARGETDIR=C:\Python', \ + 'ALLUSERS=1', \ + 'ADDLOCAL=DefaultFeature,Extensions,TclTk,Tools,PrependPath' \ + ); \ + \ +# 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.msi -Force; \ + \ + Write-Host 'Complete.'; + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'get-pip.py'; \ + 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.'; + +# install "virtualenv", since the vast majority of users of this image will want it +RUN pip install --no-cache-dir virtualenv + +CMD ["python"] diff --git a/3.5/windows/windowsservercore/Dockerfile b/3.5/windows/windowsservercore-1709/Dockerfile similarity index 97% rename from 3.5/windows/windowsservercore/Dockerfile rename to 3.5/windows/windowsservercore-1709/Dockerfile index abdbde62f..badcfc98e 100644 --- a/3.5/windows/windowsservercore/Dockerfile +++ b/3.5/windows/windowsservercore-1709/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM microsoft/windowsservercore +FROM microsoft/windowsservercore:1709 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] diff --git a/3.5/windows/windowsservercore-ltsc2016/Dockerfile b/3.5/windows/windowsservercore-ltsc2016/Dockerfile new file mode 100644 index 000000000..84aa4f7a0 --- /dev/null +++ b/3.5/windows/windowsservercore-ltsc2016/Dockerfile @@ -0,0 +1,61 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM microsoft/windowsservercore:ltsc2016 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV PYTHON_VERSION 3.5.4 +ENV PYTHON_RELEASE 3.5.4 + +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); \ + Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3.5/using/windows.html#installing-without-ui + Start-Process python.exe -Wait \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_pip=0', \ + 'Include_test=0' \ + ); \ + \ +# 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; \ + \ + Write-Host 'Complete.'; + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'get-pip.py'; \ + 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.6/windows/windowsservercore/Dockerfile b/3.6/windows/windowsservercore-1709/Dockerfile similarity index 97% rename from 3.6/windows/windowsservercore/Dockerfile rename to 3.6/windows/windowsservercore-1709/Dockerfile index 78b393f0e..d4e192cb9 100644 --- a/3.6/windows/windowsservercore/Dockerfile +++ b/3.6/windows/windowsservercore-1709/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM microsoft/windowsservercore +FROM microsoft/windowsservercore:1709 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] diff --git a/3.6/windows/windowsservercore-ltsc2016/Dockerfile b/3.6/windows/windowsservercore-ltsc2016/Dockerfile new file mode 100644 index 000000000..32197b60c --- /dev/null +++ b/3.6/windows/windowsservercore-ltsc2016/Dockerfile @@ -0,0 +1,61 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM microsoft/windowsservercore:ltsc2016 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV PYTHON_VERSION 3.6.3 +ENV PYTHON_RELEASE 3.6.3 + +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); \ + Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3.5/using/windows.html#installing-without-ui + Start-Process python.exe -Wait \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_pip=0', \ + 'Include_test=0' \ + ); \ + \ +# 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; \ + \ + Write-Host 'Complete.'; + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'get-pip.py'; \ + 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.7-rc/windows/windowsservercore/Dockerfile b/3.7-rc/windows/windowsservercore-1709/Dockerfile similarity index 97% rename from 3.7-rc/windows/windowsservercore/Dockerfile rename to 3.7-rc/windows/windowsservercore-1709/Dockerfile index e11153b87..37e04da66 100644 --- a/3.7-rc/windows/windowsservercore/Dockerfile +++ b/3.7-rc/windows/windowsservercore-1709/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM microsoft/windowsservercore +FROM microsoft/windowsservercore:1709 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] diff --git a/3.7-rc/windows/windowsservercore-ltsc2016/Dockerfile b/3.7-rc/windows/windowsservercore-ltsc2016/Dockerfile new file mode 100644 index 000000000..60f9efc0f --- /dev/null +++ b/3.7-rc/windows/windowsservercore-ltsc2016/Dockerfile @@ -0,0 +1,61 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM microsoft/windowsservercore:ltsc2016 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV PYTHON_VERSION 3.7.0a2 +ENV PYTHON_RELEASE 3.7.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); \ + Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3.5/using/windows.html#installing-without-ui + Start-Process python.exe -Wait \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_pip=0', \ + 'Include_test=0' \ + ); \ + \ +# 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; \ + \ + Write-Host 'Complete.'; + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION); \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'get-pip.py'; \ + 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/Dockerfile-windowsservercore.template b/Dockerfile-windowsservercore.template index 9c208ed74..239816906 100644 --- a/Dockerfile-windowsservercore.template +++ b/Dockerfile-windowsservercore.template @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore +FROM microsoft/windowsservercore:%%PLACEHOLDER%% SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 5a0ffcdc3..6524a82c5 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -92,7 +92,8 @@ for version in "${versions[@]}"; do for v in \ {stretch,jessie,wheezy}{,/slim,/onbuild} \ alpine{3.6,3.4} \ - windows/windowsservercore windows/nanoserver \ + windows/windowsservercore-{ltsc2016,1709} \ + windows/nanoserver-{sac2016,1709} \ ; do dir="$version/$v" variant="$(basename "$v")" @@ -144,10 +145,21 @@ for version in "${versions[@]}"; do ;; esac + sharedTags=() + for windowsShared in windowsservercore nanoserver; do + if [[ "$variant" == "$windowsShared"* ]]; then + sharedTags+=( "$windowsShared" ) + break + fi + done + if [ "$variant" = "$debianSuite" ] || [[ "$variant" == 'windowsservercore'* ]]; then + sharedTags+=( "${versionAliases[@]}" ) + fi + echo echo "Tags: $(join ', ' "${variantAliases[@]}")" - if [ "$variant" = "$debianSuite" ] || [ "$variant" = 'windowsservercore' ]; then - echo "SharedTags: $(join ', ' "${versionAliases[@]}")" + if [ "${#sharedTags[@]}" -gt 0 ]; then + echo "SharedTags: $(join ', ' "${sharedTags[@]}")" fi cat <<-EOE Architectures: $(join ', ' $variantArches) diff --git a/update.sh b/update.sh index 631ac2ce5..4265449b5 100755 --- a/update.sh +++ b/update.sh @@ -99,7 +99,8 @@ for version in "${versions[@]}"; do for v in \ alpine{3.4,3.6} \ {wheezy,jessie,stretch}{/slim,/onbuild,} \ - windows/{windowsservercore,nanoserver} \ + windows/nanoserver-{1709,sac2016} \ + windows/windowsservercore-{1709,ltsc2016} \ ; do dir="$version/$v" variant="$(basename "$v")" @@ -107,7 +108,8 @@ for version in "${versions[@]}"; do [ -d "$dir" ] || continue case "$variant" in - slim|onbuild|windowsservercore) template="$variant"; tag="$(basename "$(dirname "$dir")")" ;; + slim|onbuild) template="$variant"; tag="$(basename "$(dirname "$dir")")" ;; + windowsservercore-*) template='windowsservercore'; tag="${variant#*-}" ;; alpine*) template='alpine'; tag="${variant#alpine}" ;; *) template='debian'; tag="$variant" ;; esac @@ -129,7 +131,7 @@ for version in "${versions[@]}"; do -e 's/^(ENV PYTHON_RELEASE) .*/\1 '"${fullVersion%%[a-z]*}"'/' \ -e 's/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/' \ -e 's/^(FROM python):.*/\1:'"$version-$tag"'/' \ - -e 's/^(FROM (debian|buildpack-deps|alpine)):.*/\1:'"$tag"'/' \ + -e 's!^(FROM (debian|buildpack-deps|alpine|microsoft/[^:]+)):.*!\1:'"$tag"'!' \ "$dir/Dockerfile" case "$variant" in @@ -148,6 +150,7 @@ for version in "${versions[@]}"; do case "$v" in */onbuild) ;; + windows/*-1709) ;; # no AppVeyor support for 1709 yet: https://github.com/appveyor/ci/issues/1885 windows/*) appveyorEnv='\n - version: '"$version"'\n variant: '"$variant$appveyorEnv" ;;