Skip to content

Instantly share code, notes, and snippets.

@yuriwoof
Created November 1, 2020 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuriwoof/41fe3ca2d129c29074aa68d939bb94e6 to your computer and use it in GitHub Desktop.
Save yuriwoof/41fe3ca2d129c29074aa68d939bb94e6 to your computer and use it in GitHub Desktop.
# escape=`
FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019
# Install IIS, LogMonitor.exe and ServiceMonitor.exe
RUN powershell -Command `
New-Item -ItemType Directory C:\LogMonitor; `
$downloads = `
@( `
@{ `
uri = 'https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.10/ServiceMonitor.exe'; `
outFile = 'C:\ServiceMonitor.exe' `
}, `
@{ `
uri = 'https://github.com/microsoft/windows-container-tools/releases/download/v1.1/LogMonitor.exe'; `
outFile = 'C:\LogMonitor\LogMonitor.exe' `
}, `
@{ `
uri = 'https://raw.githubusercontent.com/microsoft/iis-docker/master/windowsservercore-insider/LogMonitorConfig.json'; `
outFile = 'C:\LogMonitor\LogMonitorConfig.json' `
} `
); `
$downloads.ForEach({ Invoke-WebRequest -UseBasicParsing -Uri $psitem.uri -OutFile $psitem.outFile })
# Change the startup type of the IIS service from Automatic to Manual
RUN sc config w3svc start=demand
# Enable ETW logging for Default Web Site on IIS
RUN c:\windows\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites /"[name='Default Web Site'].logFile.logTargetW3C:"File,ETW"" /commit:apphost
EXPOSE 80
# Start "C:\LogMonitor\LogMonitor.exe C:\ServiceMonitor.exe w3svc"
ENTRYPOINT ["C:\\LogMonitor\\LogMonitor.exe", "C:\\ServiceMonitor.exe", "w3svc"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment