Skip to content

Commit 8f94f87

Browse files
committed
Add 3.16-rc windows variants
1 parent ce73ea7 commit 8f94f87

13 files changed

Lines changed: 201 additions & 35 deletions

File tree

‎3.13/windows/windowsservercore-ltsc2022/Dockerfile‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.13/windows/windowsservercore-ltsc2025/Dockerfile‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.14/windows/windowsservercore-ltsc2022/Dockerfile‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.14/windows/windowsservercore-ltsc2025/Dockerfile‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.15/windows/windowsservercore-ltsc2022/Dockerfile‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.15/windows/windowsservercore-ltsc2025/Dockerfile‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.16-rc/windows/windowsservercore-ltsc2022/Dockerfile‎

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.16-rc/windows/windowsservercore-ltsc2025/Dockerfile‎

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Dockerfile-linux.template‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{{
2-
def is_alpine:
3-
env.variant | startswith("alpine")
4-
;
5-
def is_slim:
6-
env.variant | startswith("slim-")
7-
;
8-
def rcVersion:
9-
env.version | rtrimstr("-rc")
10-
;
2+
include "shared";
113
def clean_apt:
124
# TODO once bookworm is EOL, remove this and just hard-code "apt-get dist-clean" instead
135
if env.variant | contains("bookworm") then

‎Dockerfile-windows.template‎

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,50 @@
1+
{{
2+
include "shared"
3+
-}}
14
FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }}
25

36
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
47

58
# https://github.com/docker-library/python/pull/557
69
ENV PYTHONIOENCODING UTF-8
10+
{{
11+
# installer sets path for older python, but needs to be set for the zip download
12+
if isWindowsZip then (
13+
-}}
14+
15+
# PATH isn't actually set in the Docker image, so we have to set it from within the container
16+
RUN $newPath = ('C:\python;C:\python\Scripts;{0}' -f $env:PATH); \
17+
Write-Host ('Updating PATH: {0}' -f $newPath); \
18+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); \
19+
Write-Host 'Complete.'
20+
# doing this first to share cache across versions more aggressively
21+
{{ ) else "" end -}}
722

823
ENV PYTHON_VERSION {{ .version }}
924
{{ if .checksums.windows.sha256 then ( -}}
1025
ENV PYTHON_SHA256 {{ .checksums.windows.sha256 }}
1126
{{ ) else "" end -}}
1227

13-
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \
28+
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.{{ if isWindowsZip then "zip" else "exe" end }}' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \
1429
Write-Host ('Downloading {0} ...' -f $url); \
1530
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
16-
Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \
31+
Invoke-WebRequest -Uri $url -OutFile 'python.{{ if isWindowsZip then "zip" else "exe" end }}'; \
1732
{{ if .checksums.windows.sha256 then ( -}}
1833
\
1934
Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_SHA256); \
20-
if ((Get-FileHash python.exe -Algorithm sha256).Hash -ne $env:PYTHON_SHA256) { \
35+
if ((Get-FileHash python.{{ if isWindowsZip then "zip" else "exe" end }} -Algorithm sha256).Hash -ne $env:PYTHON_SHA256) { \
2136
Write-Host 'FAILED!'; \
2237
exit 1; \
2338
}; \
2439
{{ ) else "" end -}}
2540
\
41+
{{ if isWindowsZip then ( -}}
42+
Write-Host 'Expanding ...'; \
43+
Expand-Archive python.zip -DestinationPath C:\python\; \
44+
\
45+
Write-Host 'Removing ...'; \
46+
Remove-Item python.zip -Force; \
47+
{{ ) else ( -}}
2648
Write-Host 'Installing ...'; \
2749
# https://docs.python.org/3/using/windows.html#installing-without-ui
2850
$exitCode = (Start-Process python.exe -Wait -NoNewWindow -PassThru \
@@ -46,15 +68,25 @@ RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($en
4668
# the installer updated PATH, so we should refresh our local value
4769
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
4870
\
49-
Write-Host 'Verifying install ...'; \
50-
Write-Host ' python --version'; python --version; \
51-
\
5271
Write-Host 'Removing ...'; \
5372
Remove-Item python.exe -Force; \
5473
Remove-Item $env:TEMP/Python*.log -Force; \
74+
{{ ) end -}}
75+
\
76+
Write-Host 'Verifying install ("python --version") ...'; \
77+
python --version; \
5578
\
5679
$env:PYTHONDONTWRITEBYTECODE = '1'; \
5780
\
81+
{{ if isWindowsZip then ( -}}
82+
Write-Host 'Re-Installing pip ...'; \
83+
# remove zip-provided pip so that we can reinstall and get the exe in c:/python/Scripts
84+
Remove-Item -Recurse C:/python/Lib/site-packages/pip; \
85+
Remove-Item -Recurse C:/python/Lib/site-packages/pip-*; \
86+
# install pip again
87+
python -m ensurepip --default-pip; \
88+
\
89+
{{ ) else "" end -}}
5890
Write-Host 'Verifying pip install ...'; \
5991
pip --version; \
6092
\

0 commit comments

Comments
 (0)