Skip to content

Commit 1ad743d

Browse files
committed
Add "windowsservercore" variants
1 parent 2664a9b commit 1ad743d

File tree

6 files changed

+212
-5
lines changed

6 files changed

+212
-5
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM microsoft/windowsservercore
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
4+
5+
ENV PYTHON_VERSION 2.7.12
6+
ENV PYTHON_RELEASE 2.7.12
7+
8+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
9+
ENV PYTHON_PIP_VERSION 8.1.2
10+
11+
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}.amd64.msi' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \
12+
Write-Host ('Downloading {0} ...' -f $url); \
13+
(New-Object System.Net.WebClient).DownloadFile($url, 'python.msi'); \
14+
\
15+
Write-Host 'Installing ...'; \
16+
# https://www.python.org/download/releases/2.4/msi/
17+
Start-Process msiexec -Wait \
18+
-ArgumentList @( \
19+
'/i', \
20+
'python.msi', \
21+
'/quiet', \
22+
'/qn', \
23+
'TARGETDIR=C:\Python', \
24+
'ALLUSERS=1', \
25+
'ADDLOCAL=DefaultFeature,Extensions,TclTk,Tools,PrependPath' \
26+
); \
27+
\
28+
# the installer updated PATH, so we should refresh our local value
29+
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
30+
\
31+
Write-Host 'Verifying install ...'; \
32+
Write-Host ' python --version'; python --version; \
33+
\
34+
Write-Host 'Removing ...'; \
35+
Remove-Item python.msi -Force; \
36+
\
37+
$pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \
38+
Write-Host ('Installing {0} ...' -f $pipInstall); \
39+
(New-Object System.Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'get-pip.py'); \
40+
python get-pip.py $pipInstall; \
41+
Remove-Item get-pip.py -Force; \
42+
\
43+
Write-Host 'Verifying pip install ...'; \
44+
pip --version; \
45+
\
46+
Write-Host 'Complete.';
47+
48+
# install "virtualenv", since the vast majority of users of this image will want it
49+
RUN pip install --no-cache-dir virtualenv
50+
51+
CMD ["python"]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM microsoft/windowsservercore
8+
9+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
10+
11+
ENV PYTHON_VERSION 3.5.2
12+
ENV PYTHON_RELEASE 3.5.2
13+
14+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
15+
ENV PYTHON_PIP_VERSION 8.1.2
16+
17+
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \
18+
Write-Host ('Downloading {0} ...' -f $url); \
19+
(New-Object System.Net.WebClient).DownloadFile($url, 'python.exe'); \
20+
\
21+
Write-Host 'Installing ...'; \
22+
# https://docs.python.org/3.5/using/windows.html#installing-without-ui
23+
Start-Process python.exe -Wait \
24+
-ArgumentList @( \
25+
'/quiet', \
26+
'InstallAllUsers=1', \
27+
'TargetDir=C:\Python', \
28+
'PrependPath=1', \
29+
'Shortcuts=0', \
30+
'Include_doc=0', \
31+
'Include_test=0' \
32+
); \
33+
\
34+
# the installer updated PATH, so we should refresh our local value
35+
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
36+
\
37+
Write-Host 'Verifying install ...'; \
38+
Write-Host ' python --version'; python --version; \
39+
\
40+
Write-Host 'Removing ...'; \
41+
Remove-Item python.exe -Force; \
42+
\
43+
$pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \
44+
Write-Host ('Installing {0} ...' -f $pipInstall); \
45+
pip install --no-cache-dir --upgrade $pipInstall; \
46+
\
47+
Write-Host 'Verifying pip install ...'; \
48+
pip --version; \
49+
\
50+
Write-Host 'Complete.';
51+
52+
CMD ["python"]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM microsoft/windowsservercore
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
4+
5+
ENV PYTHON_VERSION 3.6.0a3
6+
ENV PYTHON_RELEASE 3.6.0
7+
8+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
9+
ENV PYTHON_PIP_VERSION 8.1.2
10+
11+
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \
12+
Write-Host ('Downloading {0} ...' -f $url); \
13+
(New-Object System.Net.WebClient).DownloadFile($url, 'python.exe'); \
14+
\
15+
Write-Host 'Installing ...'; \
16+
# https://docs.python.org/3.5/using/windows.html#installing-without-ui
17+
Start-Process python.exe -Wait \
18+
-ArgumentList @( \
19+
'/quiet', \
20+
'InstallAllUsers=1', \
21+
'TargetDir=C:\Python', \
22+
'PrependPath=1', \
23+
'Shortcuts=0', \
24+
'Include_doc=0', \
25+
'Include_test=0' \
26+
); \
27+
\
28+
# the installer updated PATH, so we should refresh our local value
29+
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
30+
\
31+
Write-Host 'Verifying install ...'; \
32+
Write-Host ' python --version'; python --version; \
33+
\
34+
Write-Host 'Removing ...'; \
35+
Remove-Item python.exe -Force; \
36+
\
37+
$pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \
38+
Write-Host ('Installing {0} ...' -f $pipInstall); \
39+
pip install --no-cache-dir --upgrade $pipInstall; \
40+
\
41+
Write-Host 'Verifying pip install ...'; \
42+
pip --version; \
43+
\
44+
Write-Host 'Complete.';
45+
46+
CMD ["python"]

Dockerfile-windowsservercore.template

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM microsoft/windowsservercore
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
4+
5+
ENV PYTHON_VERSION %%PLACEHOLDER%%
6+
ENV PYTHON_RELEASE %%PLACEHOLDER%%
7+
8+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
9+
ENV PYTHON_PIP_VERSION %%PLACEHOLDER%%
10+
11+
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \
12+
Write-Host ('Downloading {0} ...' -f $url); \
13+
(New-Object System.Net.WebClient).DownloadFile($url, 'python.exe'); \
14+
\
15+
Write-Host 'Installing ...'; \
16+
# https://docs.python.org/3.5/using/windows.html#installing-without-ui
17+
Start-Process python.exe -Wait \
18+
-ArgumentList @( \
19+
'/quiet', \
20+
'InstallAllUsers=1', \
21+
'TargetDir=C:\Python', \
22+
'PrependPath=1', \
23+
'Shortcuts=0', \
24+
'Include_doc=0', \
25+
'Include_test=0' \
26+
); \
27+
\
28+
# the installer updated PATH, so we should refresh our local value
29+
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
30+
\
31+
Write-Host 'Verifying install ...'; \
32+
Write-Host ' python --version'; python --version; \
33+
\
34+
Write-Host 'Removing ...'; \
35+
Remove-Item python.exe -Force; \
36+
\
37+
$pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \
38+
Write-Host ('Installing {0} ...' -f $pipInstall); \
39+
pip install --no-cache-dir --upgrade $pipInstall; \
40+
\
41+
Write-Host 'Verifying pip install ...'; \
42+
pip --version; \
43+
\
44+
Write-Host 'Complete.';
45+
46+
CMD ["python"]

generate-stackbrew-library.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,16 @@ for version in "${versions[@]}"; do
6767
Directory: $version
6868
EOE
6969

70-
for variant in slim alpine wheezy onbuild; do
71-
[ -f "$version/$variant/Dockerfile" ] || continue
70+
for v in \
71+
slim alpine wheezy onbuild \
72+
windows/windowsservercore windows/nanoserver \
73+
; do
74+
dir="$version/$v"
75+
variant="$(basename "$v")"
7276

73-
commit="$(dirCommit "$version/$variant")"
77+
[ -f "$dir/Dockerfile" ] || continue
78+
79+
commit="$(dirCommit "$dir")"
7480

7581
variantAliases=( "${versionAliases[@]/%/-$variant}" )
7682
variantAliases=( "${variantAliases[@]//latest-/}" )
@@ -79,7 +85,8 @@ for version in "${versions[@]}"; do
7985
cat <<-EOE
8086
Tags: $(join ', ' "${variantAliases[@]}")
8187
GitCommit: $commit
82-
Directory: $version/$variant
88+
Directory: $dir
8389
EOE
90+
[ "$variant" = "$v" ] || echo "Constraints: $variant"
8491
done
8592
done

update.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
set -e
3+
shopt -s nullglob
34

45
declare -A gpgKeys=(
56
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
@@ -65,12 +66,15 @@ for version in "${versions[@]}"; do
6566
alpine \
6667
slim \
6768
onbuild \
69+
windows/windowsservercore \
6870
; do
6971
if [ "$variant" = 'debian' ]; then
7072
dir="$version"
7173
else
7274
dir="$version/$variant"
75+
variant="$(basename "$variant")"
7376
fi
77+
[ -d "$dir" ] || continue
7478
template="Dockerfile-$variant.template"
7579
{ generated_warning; cat "$template"; } > "$dir/Dockerfile"
7680
done
@@ -84,9 +88,10 @@ for version in "${versions[@]}"; do
8488
sed -ri \
8589
-e 's/^(ENV GPG_KEY) .*/\1 '"${gpgKeys[$version]}"'/' \
8690
-e 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' \
91+
-e 's/^(ENV PYTHON_RELEASE) .*/\1 '"${fullVersion%%[a-z]*}"'/' \
8792
-e 's/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/' \
8893
-e 's/^(FROM python):.*/\1:'"$version"'/' \
89-
"$version"/{,*/}Dockerfile
94+
"$version"/{,*/,*/*/}Dockerfile
9095
)
9196
fi
9297
for variant in wheezy alpine slim; do

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy