Skip to content
14 changes: 5 additions & 9 deletions src/almalinux/8/helix/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ RUN dnf upgrade --refresh -y \
# libmsquic except in the 8.1-specific packages feed.)
&& dnf config-manager --add-repo=https://packages.microsoft.com/centos/8/prod/config.repo \
&& dnf install --setopt tsflags=nodocs -y \
# Get recent python3 This is needed to get a pip recent enough
# not to fail the build when installing cryptography library as
# a dependency of the helix scripts.
# Install supported version of Python (default for python3 is 3.6 which is unsupported)
python39 \
# Required for asp.net core test runs
sudo \
Expand All @@ -21,9 +19,6 @@ RUN dnf upgrade --refresh -y \
file \
&& dnf clean all

RUN python3 -m pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple \
&& python3 -m pip install ./helix_scripts-*-py3-none-any.whl

# Aspnetcore test runs expect python to be available without version suffix
RUN alternatives --set python /usr/bin/python3 \
&& ln -sf /usr/bin/pip3 /usr/bin/pip
Expand All @@ -35,6 +30,7 @@ RUN adduser --uid 1000 --shell /bin/bash --gid adm helixbot \
&& chmod 755 /root \
&& echo "helixbot ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers

USER helixbot

RUN python3 -m venv /home/helixbot/.vsts-env
# Setup helix virtual environment
ENV VIRTUAL_ENV=/home/helixbot/.vsts-env
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
23 changes: 1 addition & 22 deletions src/fedora/41/helix/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
FROM library/fedora:41 AS venv

RUN dnf upgrade --refresh -y \
&& dnf install --setopt tsflags=nodocs -y \
dnf-plugins-core \
&& dnf install --setopt=install_weak_deps=False --setopt tsflags=nodocs -y \
openssl \
python3-devel \
python3-pip \
gcc \
libatomic \
redhat-rpm-config \
&& dnf clean all

RUN python3 -m venv /venv \
&& source /venv/bin/activate \
pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple \
&& pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple \
&& pip install ./helix_scripts-*-py3-none-any.whl

FROM library/fedora:41

# Install Dependencies
Expand Down Expand Up @@ -65,8 +45,7 @@ RUN /usr/sbin/adduser --uid 1000 --shell /bin/bash --group adm helixbot \
&& echo "helixbot ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers \
&& chmod +s /usr/bin/ping

# Install Helix Dependencies
# Setup helix virtual environment
ENV VIRTUAL_ENV=/home/helixbot/.vsts-env
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=venv --chown=helixbot /venv $VIRTUAL_ENV
35 changes: 17 additions & 18 deletions src/nanoserver/1809/helix/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ RUN $apiUrl = 'https://api.github.com/repos/PowerShell/PowerShell/releases/lates
Expand-Archive -Path C:\powershell.zip -DestinationPath C:\powershell; `
Remove-Item -Path C:\powershell.zip

# Download latest stable version of Python
RUN $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]; `
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/python/$latestVersion -OutFile $env:TEMP\python.zip; `
md C:\PythonTemp; `
tar -zxf $env:TEMP\python.zip -C C:\PythonTemp;


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;"

ENV 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) && `
COPY --from=installer [ "C:\\PythonTemp\\tools", "C:\\Python\\" ]

ENV PATH="$PATH;C:\Program Files\PowerShell\;C:\Python;C:\python\scripts" `
PYTHONPATH="C:\Python\Lib;C:\Python\DLLs;"

RUN md c:\\helixtmp && pushd c:\\helixtmp && `
python -m pip install --upgrade pip && `
python -m pip install virtualenv && `
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 ; `
Expand All @@ -46,4 +46,3 @@ RUN md c:\\helixtmp && pushd c:\\helixtmp &&`
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force

WORKDIR C:\\Work

37 changes: 22 additions & 15 deletions src/windowsservercore/ltsc2019/helix/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019

SHELL ["cmd", "/S", "/C"]
USER ContainerAdministrator

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;"
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install latest stable version of Python
RUN $apiUrl = 'https://api.nuget.org/v3-flatcontainer/python/index.json'; `
Copy link
Member

Choose a reason for hiding this comment

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

It does feel a little strange the the SHELL is set to powershell here yet later on a direct powershell command is executed directly. It would be nice to have consistency within this Dockerfile.

$response = Invoke-RestMethod -Uri $apiUrl; `
$versions = $response.versions | Where-Object { $_ -notmatch '-' } | Sort-Object { [version]$_ } -Descending; `
$latestVersion = $versions[0]; `
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/python/$latestVersion -OutFile $env:TEMP\python.zip; `
md C:\Python; `
md C:\PythonTemp; `
tar -zxf $env:TEMP\python.zip -C C:\PythonTemp; `
xcopy /s c:\PythonTemp\tools C:\Python; `
Remove-Item -Recurse -Force C:\PythonTemp; `
Remove-Item -Force $env:TEMP\python.zip;"

SHELL ["cmd", "/S", "/C"]

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) && `
C:\Python\python.exe -m pip install --upgrade pip --no-warn-script-location && `
C:\Python\python.exe -m pip install virtualenv --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 ; `
Expand All @@ -26,8 +32,9 @@ RUN md c:\\helixtmp && pushd c:\\helixtmp &&`
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"
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\corerun.exe' -Value 2 -Name DumpCount -Force

WORKDIR C:\\Work
ENV PATH="$PATH;C:\Python;C:\python\scripts" `
PYTHONPATH="C:\Python\Lib;C:\Python\DLLs;"

WORKDIR C:\\Work