Skip to content

Instantly share code, notes, and snippets.

@jonasbg
Last active October 29, 2018 12:02
Show Gist options
  • Save jonasbg/b02b1683937eeb70f4d73adaa03e2e5e to your computer and use it in GitHub Desktop.
Save jonasbg/b02b1683937eeb70f4d73adaa03e2e5e to your computer and use it in GitHub Desktop.
Dockerfile for windows IIS setup for legacy ASP.NET apps - with url-rewrite
# escape=`
FROM microsoft/dotnet-framework:4.7.2-runtime
SHELL ["powershell", "-Command","$ErrorActionPreference = 'Stop';$ProgressPreference = 'SilentlyContinue';"]
RUN Set-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' `
-Name ServerPriorityTimeLimit -Value 0 -Type DWord
RUN Add-WindowsFeature Web-server, `
NET-Framework-45-ASPNET, Web-Asp-Net45; `
Remove-Website -Name 'Default Web Site'
COPY Dodsmelding /Dodsmelding
RUN New-Website -name 'dodsmelding' `
-PhysicalPath 'C:\Dodsmelding' -Port 80 -Force
ADD https://download.microsoft.com/download/C/9/E/C9E8180D-4E51-40A6-A9BF-776990D8BCA9/rewrite_amd64.msi /install/rewrite_amd64.msi
RUN msiexec.exe /i c:\install\rewrite_amd64.msi /passive
RUN powershell -Command `
Invoke-WebRequest -UseBasicParsing -Uri "https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.6/ServiceMonitor.exe" -OutFile "C:\ServiceMonitor.exe"
EXPOSE 80
CMD ["C:\\ServiceMonitor.exe", "w3svc"]
# kjøres hver 30s 'warm up siden IIS aldri blir kald'
HEALTHCHECK CMD powershell -command `
try { `
$response = iwr http://localhost:80 -UseBasicParsing `
if ($response.StatusCode -eq 200) { return 0 } `
else { return 1 } `
} catch { return 1 }
@jonasbg
Copy link
Author

jonasbg commented Oct 25, 2018

Download and compile Servicemonitor from Microsoft Github.

ServiceMonitor is now downloaded directly from Microsoft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment