# Replicates the GitHub Actions CI environment for PS 7.x unit tests FROM mcr.microsoft.com/powershell:7.5-ubuntu-24.04 # Install .NET SDK 9.0, build module, install Pester, copy to module path RUN apt-get update && apt-get install -y wget \ && wget https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh \ && chmod +x /tmp/dotnet-install.sh \ && /tmp/dotnet-install.sh --channel 9.0 --install-dir /usr/share/dotnet \ && ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet \ && rm /tmp/dotnet-install.sh \ && rm -rf /var/lib/apt/lists/* WORKDIR /repo COPY . . RUN dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj \ --configuration Release --framework net9.0 --output ./publish/net9.0 \ && rm -f ./publish/net9.0/PSProxmoxVE.deps.json \ && pwsh -NoProfile -Command ' \ Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope AllUsers; \ $modulePath = "/usr/local/share/powershell/Modules/PSProxmoxVE"; \ New-Item -ItemType Directory -Path $modulePath -Force | Out-Null; \ Copy-Item -Path ./publish/net9.0/* -Destination $modulePath -Recurse -Force' # Unset DOTNET_ROOT so PS uses its own bundled runtime ENV DOTNET_ROOT="" ENV DOTNET_MULTILEVEL_LOOKUP="" CMD ["pwsh", "-NoProfile", "-Command", " \ Import-Module Pester -MinimumVersion 5.0; \ $config = New-PesterConfiguration; \ $config.Run.Path = 'tests/PSProxmoxVE.Tests'; \ $config.Run.Exit = $true; \ $config.Filter.ExcludeTag = @('Integration'); \ $config.Output.Verbosity = 'Detailed'; \ Invoke-Pester -Configuration $config"]