Skip to content

Commit

Permalink
Clean up smoke tests a little
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlock committed Feb 10, 2025
1 parent 4ad7320 commit 2df6a66
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ WORKDIR /app

ARG CHANNEL
ARG TARGET_PLATFORM
COPY ./build/_build/bootstrap/dotnet-install.ps1 .

# Install the hosting bundle
RUN $url='https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/' + $env:CHANNEL + '.0/dotnet-hosting-' + $env:CHANNEL + '.0-win.exe'; \
Expand Down Expand Up @@ -56,17 +55,14 @@ COPY --from=builder /src/publish /app/.
RUN Remove-WebSite -Name 'Default Web Site'; \
$ENABLE_32_BIT='false'; \
if($env:TARGET_PLATFORM -eq 'x86') { $ENABLE_32_BIT='true' }; \
Write-Host "Creating website with 32 bit reg key: $env:ENABLE_32_BIT"; \
c:\Windows\System32\inetsrv\appcmd add apppool /startMode:"AlwaysRunning" /autoStart:"false" /name:AspNetCorePool /managedRuntimeVersion:"" /enable32bitapponwin64:$ENABLE_32_BIT; \
Write-Host "Creating website with 32 bit enabled: $env:ENABLE_32_BIT"; \
c:\Windows\System32\inetsrv\appcmd add apppool /startMode:"AlwaysRunning" /autoStart:"true" /name:AspNetCorePool /managedRuntimeVersion:"" /enable32bitapponwin64:$ENABLE_32_BIT; \
New-Website -Name 'SmokeTest' -Port 5000 -PhysicalPath 'c:\app' -ApplicationPool 'AspNetCorePool'; \
Set-ItemProperty "IIS:\Sites\SmokeTest" -Name applicationDefaults.preloadEnabled -Value True;
# Restart IIS
RUN net stop /y was; \
net start w3svc
# We override the normal service monitor entrypoint, because we want the container to shut down after the request is sent
# We would really like to get the pid of the worker processes, but we can't do that easily
# This is all way more convoluted than it feels like it should be, but it's the only way I could find to get things to work as required
RUN echo 'Write-Host \"Running servicemonitor to copy variables\"; Start-Process -NoNewWindow -PassThru -FilePath \"c:/ServiceMonitor.exe\" -ArgumentList @(\"w3svc\", \"AspNetCorePool\");' > C:\app\entrypoint.ps1; \
echo 'Write-Host \"Starting AspNetCorePool app pool\"; Start-WebAppPool -Name \"AspNetCorePool\" -PassThru;' >> C:\app\entrypoint.ps1; \
echo 'Write-Host \"Making 404 request\"; curl http://localhost:5000;' >> C:\app\entrypoint.ps1; \
Expand Down

0 comments on commit 2df6a66

Please sign in to comment.