diff --git a/2.7/windows/windowsservercore/Dockerfile b/2.7/windows/windowsservercore/Dockerfile new file mode 100644 index 0000000..901c813 --- /dev/null +++ b/2.7/windows/windowsservercore/Dockerfile @@ -0,0 +1,51 @@ +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION 2.7.12 +ENV PYTHON_RELEASE 2.7.12 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 8.1.2 + +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); \ + (New-Object System.Net.WebClient).DownloadFile($url, '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; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ + (New-Object System.Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'get-pip.py'); \ + python get-pip.py $pipInstall; \ + 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/Dockerfile new file mode 100644 index 0000000..917dfb0 --- /dev/null +++ b/3.5/windows/windowsservercore/Dockerfile @@ -0,0 +1,52 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION 3.5.2 +ENV PYTHON_RELEASE 3.5.2 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 8.1.2 + +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); \ + (New-Object System.Net.WebClient).DownloadFile($url, '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_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; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ + pip install --no-cache-dir --upgrade $pipInstall; \ + \ + 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/Dockerfile new file mode 100644 index 0000000..ec45dc5 --- /dev/null +++ b/3.6/windows/windowsservercore/Dockerfile @@ -0,0 +1,46 @@ +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION 3.6.0a3 +ENV PYTHON_RELEASE 3.6.0 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 8.1.2 + +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); \ + (New-Object System.Net.WebClient).DownloadFile($url, '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_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; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ + pip install --no-cache-dir --upgrade $pipInstall; \ + \ + Write-Host 'Verifying pip install ...'; \ + pip --version; \ + \ + Write-Host 'Complete.'; + +CMD ["python"] diff --git a/Dockerfile-windowsservercore.template b/Dockerfile-windowsservercore.template new file mode 100644 index 0000000..d74d0f9 --- /dev/null +++ b/Dockerfile-windowsservercore.template @@ -0,0 +1,46 @@ +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION %%PLACEHOLDER%% +ENV PYTHON_RELEASE %%PLACEHOLDER%% + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% + +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); \ + (New-Object System.Net.WebClient).DownloadFile($url, '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_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; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ + pip install --no-cache-dir --upgrade $pipInstall; \ + \ + 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 8b166f2..92bf0e3 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -67,10 +67,16 @@ for version in "${versions[@]}"; do Directory: $version EOE - for variant in slim alpine wheezy onbuild; do - [ -f "$version/$variant/Dockerfile" ] || continue + for v in \ + slim alpine wheezy onbuild \ + windows/windowsservercore windows/nanoserver \ + ; do + dir="$version/$v" + variant="$(basename "$v")" - commit="$(dirCommit "$version/$variant")" + [ -f "$dir/Dockerfile" ] || continue + + commit="$(dirCommit "$dir")" variantAliases=( "${versionAliases[@]/%/-$variant}" ) variantAliases=( "${variantAliases[@]//latest-/}" ) @@ -79,7 +85,8 @@ for version in "${versions[@]}"; do cat <<-EOE Tags: $(join ', ' "${variantAliases[@]}") GitCommit: $commit - Directory: $version/$variant + Directory: $dir EOE + [ "$variant" = "$v" ] || echo "Constraints: $variant" done done diff --git a/update.sh b/update.sh index 3a363a6..fae90ae 100755 --- a/update.sh +++ b/update.sh @@ -1,5 +1,6 @@ #!/bin/bash set -e +shopt -s nullglob declare -A gpgKeys=( # gpg: key 18ADD4FF: public key "Benjamin Peterson " imported @@ -65,12 +66,15 @@ for version in "${versions[@]}"; do alpine \ slim \ onbuild \ + windows/windowsservercore \ ; do if [ "$variant" = 'debian' ]; then dir="$version" else dir="$version/$variant" + variant="$(basename "$variant")" fi + [ -d "$dir" ] || continue template="Dockerfile-$variant.template" { generated_warning; cat "$template"; } > "$dir/Dockerfile" done @@ -84,9 +88,10 @@ for version in "${versions[@]}"; do sed -ri \ -e 's/^(ENV GPG_KEY) .*/\1 '"${gpgKeys[$version]}"'/' \ -e 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' \ + -e 's/^(ENV PYTHON_RELEASE) .*/\1 '"${fullVersion%%[a-z]*}"'/' \ -e 's/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/' \ -e 's/^(FROM python):.*/\1:'"$version"'/' \ - "$version"/{,*/}Dockerfile + "$version"/{,*/,*/*/}Dockerfile ) fi for variant in wheezy alpine slim; do