Merge pull request #142 from infosiftr/windowsservercore

Add "windowsservercore" variants
This commit is contained in:
yosifkit 2016-08-18 16:49:34 -07:00 committed by GitHub
commit 9286f026a6
6 changed files with 212 additions and 5 deletions

View File

@ -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 '<VERSION>'"
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"]

View File

@ -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 '<VERSION>'"
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"]

View File

@ -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 '<VERSION>'"
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"]

View File

@ -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 '<VERSION>'"
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"]

View File

@ -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

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
shopt -s nullglob
declare -A gpgKeys=(
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" 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