Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 64 additions & 28 deletions src/nanoserver/1809/helix/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,73 @@ RUN $apiUrl = 'https://api.github.com/repos/PowerShell/PowerShell/releases/lates

FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/S", "/C"]
USER ContainerAdministrator
ENTRYPOINT C:\Windows\System32\cmd.exe

COPY --from=installer [ "C:\\powershell\\", "C:\\Program Files\\PowerShell\\" ]

RUN curl -SL --output %TEMP%\python.zip https://www.nuget.org/api/v2/package/python/3.7.3 `
&& md C:\Python C:\PythonTemp `
&& tar -zxf %TEMP%\python.zip -C C:\PythonTemp `
&& xcopy /s c:\PythonTemp\tools C:\Python `
&& rd /s /q c:\PythonTemp `
&& del /q %TEMP%\python.zip `
&& setx /M PYTHONPATH "C:\Python\Lib;C:\Python\DLLs;"

RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell\;C:\Python;C:\python\scripts"

RUN md c:\\helixtmp && pushd c:\\helixtmp &&`
python -m pip install --upgrade pip==20.2 && `
python -m pip install virtualenv==16.6.0 && `
pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple && `
for %f in (.\helix_scripts-*-py3-none-any.whl) do (pip install %f) && `
popd && rd /s /q c:\\helixtmp && `
pwsh -Command `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'dotnet.exe' -Force -ErrorAction SilentlyContinue ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpType -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 'C:\cores' -Name DumpFolder -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpCount -Force ; `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpType -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 'C:\cores' -Name DumpFolder -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force
RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell\;C:\Python;C:\python\scripts" && `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't break anything (I hope) but suggest defining %VIRTUAL_ENV% first then including %VIRTUAL_ENV%\\Scripts in %PATH%

setx /M PYTHONPATH "C:\Python\Lib;C:\Python\DLLs;" && `
setx /M VIRTUAL_ENV "C:\Python-env"

WORKDIR C:\\Work
# Install latest stable version of Python
RUN pwsh -Command " `
$apiUrl = 'https://api.nuget.org/v3-flatcontainer/python/index.json'; `
$response = Invoke-RestMethod -Uri $apiUrl; `
$versions = $response.versions | Where-Object { $_ -notmatch '-' } | Sort-Object { [version]$_ } -Descending; `
$latestVersion = $versions[0]; `
echo \"Downloading Python $latestVersion\"; `
$pythonZip = \"$env:TEMP\python.zip\"; `
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/python/$latestVersion -OutFile $pythonZip; `
$pythonTemp = 'C:\PythonTemp'; `
md $pythonTemp; `
tar -zxf $pythonZip -C $pythonTemp; `
if ($LASTEXITCODE -ne 0) { `
echo 'Failed to extract Python'; `
exit 1; `
} `
xcopy /s /i c:\PythonTemp\tools C:\Python; `
if ($LASTEXITCODE -ne 0) { `
echo 'Failed to copy Python'; `
exit 1; `
} `
Remove-Item -Recurse -Force $pythonTemp; `
Remove-Item -Force $pythonZip;"

# Install Helix
RUN pwsh -Command " `
$helixTemp = 'C:\helixtmp'; `
md $helixTemp; `
pushd $helixTemp; `
python -m venv $env:VIRTUAL_ENV; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to create Python virtual environment\"; `
exit 1; `
} `
& $env:VIRTUAL_ENV\Scripts\pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to download Helix scripts\"; `
exit 1; `
} `
Get-ChildItem -Path $helixTemp -Filter 'helix_scripts-*-py3-none-any.whl' | `
ForEach-Object { `
& $env:VIRTUAL_ENV\Scripts\pip install $_.FullName --no-cache-dir; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to install Helix script: $($_.Name)\"; `
exit 1; `
} `
}; `
popd; `
Remove-Item -Recurse -Force $helixTemp;"

# Configure crash dumps for dotnet.exe and corerun.exe
RUN pwsh -Command " `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'dotnet.exe' -Force -ErrorAction SilentlyContinue; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpType -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 'C:\cores' -Name DumpFolder -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpCount -Force; `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpType -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 'C:\cores' -Name DumpFolder -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force"

WORKDIR C:\\Work
88 changes: 62 additions & 26 deletions src/windowsservercore/ltsc2019/helix/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,69 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019

SHELL ["cmd", "/S", "/C"]
USER ContainerAdministrator
RUN setx /M PATH "%PATH%;C:\Python;C:\python\scripts" && `
setx /M PYTHONPATH "C:\Python\Lib;C:\Python\DLLs;" && `
setx /M VIRTUAL_ENV "C:\Python-env"

RUN curl -SL --output %TEMP%\python.zip https://www.nuget.org/api/v2/package/python/3.7.3 `
&& md C:\Python C:\PythonTemp `
&& tar -zxf %TEMP%\python.zip -C C:\PythonTemp `
&& xcopy /s c:\PythonTemp\tools C:\Python `
&& rd /s /q c:\PythonTemp `
&& del /q %TEMP%\python.zip `
&& setx /M PYTHONPATH "C:\Python\Lib;C:\Python\DLLs;"
# Install latest stable version of Python
RUN powershell -Command " `
$apiUrl = 'https://api.nuget.org/v3-flatcontainer/python/index.json'; `
$response = Invoke-RestMethod -Uri $apiUrl; `
$versions = $response.versions | Where-Object { $_ -notmatch '-' } | Sort-Object { [version]$_ } -Descending; `
$latestVersion = $versions[0]; `
echo \"Downloading Python $latestVersion\"; `
$pythonZip = \"$env:TEMP\python.zip\"; `
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/python/$latestVersion -OutFile $pythonZip; `
$pythonTemp = 'C:\PythonTemp'; `
md $pythonTemp; `
tar -zxf $pythonZip -C $pythonTemp; `
if ($LASTEXITCODE -ne 0) { `
echo 'Failed to extract Python'; `
exit 1; `
} `
xcopy /s /i c:\PythonTemp\tools C:\Python; `
if ($LASTEXITCODE -ne 0) { `
echo 'Failed to copy Python'; `
exit 1; `
} `
Remove-Item -Recurse -Force $pythonTemp; `
Remove-Item -Force $pythonZip;"

RUN md c:\\helixtmp && pushd c:\\helixtmp &&`
C:\Python\python.exe -m pip install --upgrade pip==20.2 --no-warn-script-location && `
C:\Python\python.exe -m pip install virtualenv==16.6.0 --no-warn-script-location && `
C:\Python\python.exe -m pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple && `
for %f in (.\helix_scripts-*-py3-none-any.whl) do (C:\Python\python.exe -m pip install %f --no-warn-script-location) && `
popd && rd /s /q c:\\helixtmp && `
powershell -Command `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'dotnet.exe' -Force -ErrorAction SilentlyContinue ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpType -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 'C:\cores' -Name DumpFolder -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpCount -Force ; `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpType -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 'C:\cores' -Name DumpFolder -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force && `
setx /M PATH "%PATH%;C:\Python;C:\python\scripts"
# Install Helix
RUN powershell -Command " `
$helixTemp = 'C:\helixtmp'; `
md $helixTemp; `
pushd $helixTemp; `
python -m venv $env:VIRTUAL_ENV; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to create Python virtual environment\"; `
exit 1; `
} `
& $env:VIRTUAL_ENV\Scripts\pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to download Helix scripts\"; `
exit 1; `
} `
Get-ChildItem -Path $helixTemp -Filter 'helix_scripts-*-py3-none-any.whl' | `
ForEach-Object { `
& $env:VIRTUAL_ENV\Scripts\pip install $_.FullName --no-cache-dir; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to install Helix script: $($_.Name)\"; `
exit 1; `
} `
}; `
popd; `
Remove-Item -Recurse -Force $helixTemp;"

WORKDIR C:\\Work
# Configure crash dumps for dotnet.exe and corerun.exe
RUN powershell -Command " `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'dotnet.exe' -Force -ErrorAction SilentlyContinue; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpType -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 'C:\cores' -Name DumpFolder -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpCount -Force; `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpType -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 'C:\cores' -Name DumpFolder -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force"

WORKDIR C:\\Work
87 changes: 62 additions & 25 deletions src/windowsservercore/ltsc2022/helix/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,69 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2022

SHELL ["cmd", "/S", "/C"]
USER ContainerAdministrator
RUN setx /M PATH "%PATH%;C:\Python;C:\python\scripts" && `
setx /M PYTHONPATH "C:\Python\Lib;C:\Python\DLLs;" && `
setx /M VIRTUAL_ENV "C:\Python-env"

RUN curl -SL --output %TEMP%\python.zip https://www.nuget.org/api/v2/package/python/3.7.3 `
&& md C:\Python C:\PythonTemp `
&& tar -zxf %TEMP%\python.zip -C C:\PythonTemp `
&& xcopy /s c:\PythonTemp\tools C:\Python `
&& rd /s /q c:\PythonTemp `
&& del /q %TEMP%\python.zip `
&& setx /M PYTHONPATH "C:\Python\Lib;C:\Python\DLLs;"
# Install latest stable version of Python
RUN powershell -Command " `
$apiUrl = 'https://api.nuget.org/v3-flatcontainer/python/index.json'; `
$response = Invoke-RestMethod -Uri $apiUrl; `
$versions = $response.versions | Where-Object { $_ -notmatch '-' } | Sort-Object { [version]$_ } -Descending; `
$latestVersion = $versions[0]; `
echo \"Downloading Python $latestVersion\"; `
$pythonZip = \"$env:TEMP\python.zip\"; `
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/python/$latestVersion -OutFile $pythonZip; `
$pythonTemp = 'C:\PythonTemp'; `
md $pythonTemp; `
tar -zxf $pythonZip -C $pythonTemp; `
if ($LASTEXITCODE -ne 0) { `
echo 'Failed to extract Python'; `
exit 1; `
} `
xcopy /s /i c:\PythonTemp\tools C:\Python; `
if ($LASTEXITCODE -ne 0) { `
echo 'Failed to copy Python'; `
exit 1; `
} `
Remove-Item -Recurse -Force $pythonTemp; `
Remove-Item -Force $pythonZip;"

RUN md c:\\helixtmp && pushd c:\\helixtmp &&`
C:\Python\python.exe -m pip install --upgrade pip==20.2 --no-warn-script-location && `
C:\Python\python.exe -m pip install virtualenv==16.6.0 --no-warn-script-location && `
C:\Python\python.exe -m pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple && `
for %f in (.\helix_scripts-*-py3-none-any.whl) do (C:\Python\python.exe -m pip install %f --no-warn-script-location) && `
popd && rd /s /q c:\\helixtmp && `
powershell -Command `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'dotnet.exe' -Force -ErrorAction SilentlyContinue ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpType -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 'C:\cores' -Name DumpFolder -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpCount -Force ; `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpType -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 'C:\cores' -Name DumpFolder -Force ; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force && `
setx /M PATH "%PATH%;C:\Python;C:\python\scripts"
# Install Helix
RUN powershell -Command " `
$helixTemp = 'C:\helixtmp'; `
md $helixTemp; `
pushd $helixTemp; `
python -m venv $env:VIRTUAL_ENV; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to create Python virtual environment\"; `
exit 1; `
} `
& $env:VIRTUAL_ENV\Scripts\pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to download Helix scripts\"; `
exit 1; `
} `
Get-ChildItem -Path $helixTemp -Filter 'helix_scripts-*-py3-none-any.whl' | `
ForEach-Object { `
& $env:VIRTUAL_ENV\Scripts\pip install $_.FullName --no-cache-dir; `
if ($LASTEXITCODE -ne 0) { `
echo \"Failed to install Helix script: $($_.Name)\"; `
exit 1; `
} `
}; `
popd; `
Remove-Item -Recurse -Force $helixTemp;"

# Configure crash dumps for dotnet.exe and corerun.exe
RUN powershell -Command " `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'dotnet.exe' -Force -ErrorAction SilentlyContinue; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpType -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 'C:\cores' -Name DumpFolder -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe' -Value 2 -Name DumpCount -Force; `
New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\' -Name 'corerun.exe' -Force -ErrorAction SilentlyContinue; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpType -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 'C:\cores' -Name DumpFolder -Force; `
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force"

WORKDIR C:\\Work
Loading