Skip to content

Commit 82267b6

Browse files
committed
Add 3.16-rc windows variants
1 parent e316b6c commit 82267b6

11 files changed

Lines changed: 208 additions & 38 deletions

File tree

‎3.13/windows/windowsservercore-ltsc2022/Dockerfile‎

Lines changed: 4 additions & 4 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: 4 additions & 4 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: 4 additions & 4 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: 4 additions & 4 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: 4 additions & 4 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: 4 additions & 4 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-windows.template‎

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,54 @@
1+
{{
2+
def extension:
3+
.checksums.windows.url | sub(".*[.]"; "")
4+
;
5+
def is_windows_zip:
6+
extension == "zip"
7+
-}}
18
FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }}
29

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

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

827
ENV PYTHON_VERSION {{ .version }}
928
{{ if .checksums.windows.sha256 then ( -}}
1029
ENV PYTHON_SHA256 {{ .checksums.windows.sha256 }}
1130
{{ ) else "" end -}}
1231

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); \
32+
RUN $url = '{{ .checksums.windows.url }}'; \
1433
Write-Host ('Downloading {0} ...' -f $url); \
1534
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
16-
Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \
35+
Invoke-WebRequest -Uri $url -OutFile 'python.{{ extension }}'; \
1736
{{ if .checksums.windows.sha256 then ( -}}
1837
\
1938
Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_SHA256); \
20-
if ((Get-FileHash python.exe -Algorithm sha256).Hash -ne $env:PYTHON_SHA256) { \
39+
if ((Get-FileHash python.{{ extension }} -Algorithm sha256).Hash -ne $env:PYTHON_SHA256) { \
2140
Write-Host 'FAILED!'; \
2241
exit 1; \
2342
}; \
2443
{{ ) else "" end -}}
2544
\
45+
{{ if is_windows_zip then ( -}}
46+
Write-Host 'Expanding ...'; \
47+
Expand-Archive python.zip -DestinationPath C:\Python\; \
48+
\
49+
Write-Host 'Removing ...'; \
50+
Remove-Item python.zip -Force; \
51+
{{ ) else ( -}}
2652
Write-Host 'Installing ...'; \
2753
# https://docs.python.org/3/using/windows.html#installing-without-ui
2854
$exitCode = (Start-Process python.exe -Wait -NoNewWindow -PassThru \
@@ -46,15 +72,25 @@ RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($en
4672
# the installer updated PATH, so we should refresh our local value
4773
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
4874
\
49-
Write-Host 'Verifying install ...'; \
50-
Write-Host ' python --version'; python --version; \
51-
\
5275
Write-Host 'Removing ...'; \
5376
Remove-Item python.exe -Force; \
5477
Remove-Item $env:TEMP/Python*.log -Force; \
78+
{{ ) end -}}
79+
\
80+
Write-Host 'Verifying install ("python --version") ...'; \
81+
python --version; \
5582
\
5683
$env:PYTHONDONTWRITEBYTECODE = '1'; \
5784
\
85+
{{ if is_windows_zip then ( -}}
86+
Write-Host 'Re-Installing pip ...'; \
87+
# remove zip-provided pip so that we can reinstall and get the exe in c:/python/Scripts
88+
Remove-Item -Recurse C:/python/Lib/site-packages/pip; \
89+
Remove-Item -Recurse C:/python/Lib/site-packages/pip-*; \
90+
# install pip again
91+
python -m ensurepip --default-pip; \
92+
\
93+
{{ ) else "" end -}}
5894
Write-Host 'Verifying pip install ...'; \
5995
pip --version; \
6096
\

0 commit comments

Comments
 (0)