@@ -13,37 +13,73 @@ RUN $apiUrl = 'https://api.github.com/repos/PowerShell/PowerShell/releases/lates
13
13
14
14
FROM mcr.microsoft.com/windows/nanoserver:1809
15
15
16
- SHELL ["cmd" , "/S" , "/C" ]
17
16
USER ContainerAdministrator
18
- ENTRYPOINT C:\W indows\S ystem32\c md.exe
19
17
20
18
COPY --from=installer [ "C:\\ powershell\\ " , "C:\\ Program Files\\ PowerShell\\ " ]
21
19
22
- RUN curl -SL --output %TEMP%\p ython.zip https://www.nuget.org/api/v2/package/python/3.7.3 `
23
- && md C:\P ython C:\P ythonTemp `
24
- && tar -zxf %TEMP%\p ython.zip -C C:\P ythonTemp `
25
- && xcopy /s c:\P ythonTemp\t ools C:\P ython `
26
- && rd /s /q c:\P ythonTemp `
27
- && del /q %TEMP%\p ython.zip `
28
- && setx /M PYTHONPATH "C:\P ython\L ib;C:\P ython\D LLs;"
29
-
30
- RUN setx /M PATH "%PATH%;C:\P rogram Files\P owerShell\; C:\P ython;C:\p ython\s cripts"
31
-
32
- RUN md c:\\ helixtmp && pushd c:\\ helixtmp &&`
33
- python -m pip install --upgrade pip==20.2 && `
34
- python -m pip install virtualenv==16.6.0 && `
35
- pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple && `
36
- for %f in (.\h elix_scripts-*-py3-none-any.whl) do (pip install %f) && `
37
- popd && rd /s /q c:\\ helixtmp && `
38
- pwsh -Command `
39
- New-Item -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\' -Name ' dotnet.exe' -Force -ErrorAction SilentlyContinue ; `
40
- Set-ItemProperty -Path ' HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\d otnet.exe' -Value 2 -Name DumpType -Force ; `
41
- Set-ItemProperty -Path ' HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\d otnet.exe' -Value ' C:\c ores' -Name DumpFolder -Force ; `
42
- Set-ItemProperty -Path ' HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\d otnet.exe' -Value 2 -Name DumpCount -Force ; `
43
- New-Item -Path ' HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue ; `
44
- Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\c orerun.exe' -Value 2 -Name DumpType -Force ; `
45
- Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\c orerun.exe' -Value 'C:\c ores' -Name DumpFolder -Force ; `
46
- Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\c orerun.exe' -Value 2 -Name DumpCount -Force
20
+ RUN setx /M VIRTUAL_ENV "C:\P ython-env" && `
21
+ setx /M PATH "%PATH%;C:\P rogram Files\P owerShell\; %VIRTUAL_ENV%\S cripts;C:\P ython;C:\p ython\s cripts" && `
22
+ setx /M PYTHONPATH "C:\P ython\L ib;C:\P ython\D LLs;"
47
23
48
- WORKDIR C:\\ Work
24
+ # Install latest stable version of Python
25
+ RUN pwsh -Command " `
26
+ $apiUrl = 'https://api.nuget.org/v3-flatcontainer/python/index.json'; `
27
+ $response = Invoke-RestMethod -Uri $apiUrl; `
28
+ $versions = $response.versions | Where-Object { $_ -notmatch '-' } | Sort-Object { [version]$_ } -Descending; `
29
+ $latestVersion = $versions[0]; `
30
+ echo \" Downloading Python $latestVersion\" ; `
31
+ $pythonZip = \" $env:TEMP\p ython.zip\" ; `
32
+ Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/python/$latestVersion -OutFile $pythonZip; `
33
+ $pythonTemp = 'C:\P ythonTemp'; `
34
+ md $pythonTemp; `
35
+ tar -zxf $pythonZip -C $pythonTemp; `
36
+ if ($LASTEXITCODE -ne 0) { `
37
+ echo 'Failed to extract Python'; `
38
+ exit 1; `
39
+ } `
40
+ xcopy /s /i c:\P ythonTemp\t ools C:\P ython; `
41
+ if ($LASTEXITCODE -ne 0) { `
42
+ echo 'Failed to copy Python'; `
43
+ exit 1; `
44
+ } `
45
+ Remove-Item -Recurse -Force $pythonTemp; `
46
+ Remove-Item -Force $pythonZip;"
47
+
48
+ # Install Helix
49
+ RUN pwsh -Command " `
50
+ $helixTemp = 'C:\h elixtmp'; `
51
+ md $helixTemp; `
52
+ pushd $helixTemp; `
53
+ python -m venv $env:VIRTUAL_ENV; `
54
+ if ($LASTEXITCODE -ne 0) { `
55
+ echo \" Failed to create Python virtual environment\" ; `
56
+ exit 1; `
57
+ } `
58
+ & pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple; `
59
+ if ($LASTEXITCODE -ne 0) { `
60
+ echo \" Failed to download Helix scripts\" ; `
61
+ exit 1; `
62
+ } `
63
+ Get-ChildItem -Path $helixTemp -Filter 'helix_scripts-*-py3-none-any.whl' | `
64
+ ForEach-Object { `
65
+ & pip install $_.FullName --no-cache-dir; `
66
+ if ($LASTEXITCODE -ne 0) { `
67
+ echo \" Failed to install Helix script: $($_.Name)\" ; `
68
+ exit 1; `
69
+ } `
70
+ }; `
71
+ popd; `
72
+ Remove-Item -Recurse -Force $helixTemp;"
49
73
74
+ # Configure crash dumps for dotnet.exe and corerun.exe
75
+ RUN pwsh -Command " `
76
+ New-Item -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\' -Name 'dotnet.exe' -Force -ErrorAction SilentlyContinue; `
77
+ Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\d otnet.exe' -Value 2 -Name DumpType -Force; `
78
+ Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\d otnet.exe' -Value 'C:\c ores' -Name DumpFolder -Force; `
79
+ Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\d otnet.exe' -Value 2 -Name DumpCount -Force; `
80
+ New-Item -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue; `
81
+ Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\c orerun.exe' -Value 2 -Name DumpType -Force; `
82
+ Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\c orerun.exe' -Value 'C:\c ores' -Name DumpFolder -Force; `
83
+ Set-ItemProperty -Path 'HKLM:\S OFTWARE\M icrosoft\W indows\W indows Error Reporting\L ocalDumps\c orerun.exe' -Value 2 -Name DumpCount -Force"
84
+
85
+ WORKDIR C:\\ Work
0 commit comments