|
| 1 | +# escape=` |
| 2 | +FROM python:3.6-windowsservercore AS python |
| 3 | + |
1 | 4 | FROM microsoft/nanoserver |
2 | 5 |
|
| 6 | +COPY --from=python /Python /Python |
| 7 | + |
3 | 8 | SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
4 | 9 |
|
5 | 10 | ENV PYTHON_VERSION 3.6.1 |
6 | 11 | ENV PYTHON_PIP_VERSION 9.0.1 |
7 | 12 |
|
8 | | -RUN Invoke-WebRequest $('https://www.python.org/ftp/python/{0}/python-{0}-embed-amd64.zip' -f $env:PYTHON_VERSION) -OutFile 'python.zip' -UseBasicParsing ; \ |
9 | | - Expand-Archive python.zip -DestinationPath C:\python ; \ |
10 | | - $env:PATH = 'C:\python;C:\python\Scripts;{0}' -f $env:PATH ; \ |
11 | | - Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \ |
12 | | - Remove-Item -Path python.zip ; \ |
13 | | - mkdir $env:APPDATA\Python\Python36\site-packages ; \ |
14 | | - Invoke-WebRequest 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'get-pip.py' -UseBasicParsing ; \ |
15 | | - $replace = ('import tempfile{0}import site{0}site.getusersitepackages()' -f [char][int]10) ; \ |
16 | | - Get-Content get-pip.py | Foreach-Object { $_ -replace 'import tempfile', $replace } | Out-File -Encoding Ascii getpip.py ; \ |
17 | | - $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION) ; \ |
18 | | - python getpip.py $pipInstall ; \ |
19 | | - Remove-Item get-pip.py ; \ |
| 13 | +RUN $env:PATH = 'C:\Python;C:\Python\Scripts;{0}' -f $env:PATH ; ` |
| 14 | + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; ` |
| 15 | + mkdir $env:APPDATA\Python\Python36\site-packages ; ` |
| 16 | + Invoke-WebRequest 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'get-pip.py' -UseBasicParsing ; ` |
| 17 | + $replace = ('import tempfile{0}import site{0}site.getusersitepackages()' -f [char][int]10) ; ` |
| 18 | + Get-Content get-pip.py | Foreach-Object { $_ -replace 'import tempfile', $replace } | Out-File -Encoding Ascii getpip.py ; ` |
| 19 | + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION) ; ` |
| 20 | + python getpip.py $pipInstall ; ` |
| 21 | + Remove-Item get-pip.py ; ` |
20 | 22 | Remove-Item getpip.py |
21 | 23 |
|
22 | 24 | RUN pip install --no-cache-dir virtualenv |
|
0 commit comments