npx skills add ...
npx skills add github/awesome-copilot --skill containerize-aspnet-framework
npx skills add github/awesome-copilot --skill containerize-aspnet-framework
Containerize an ASP.NET .NET Framework project by creating Dockerfile and .dockerfile files customized for the project.
Containerize the ASP.NET (.NET Framework) project specified in the containerization settings below, focusing exclusively on changes required for the application to run in a Windows Docker container. Containerization should consider all settings specified here.
REMEMBER: This is a .NET Framework application, not .NET Core. The containerization process will be different from that of a .NET Core application.
This section of the prompt contains the specific settings and configurations required for containerizing the ASP.NET (.NET Framework) application. Prior to running this prompt, ensure that the settings are filled out with the necessary information. Note that in many cases, only the first few settings are required. Later settings can be left as defaults if they do not apply to the project being containerized.
Any settings that are not specified will be set to default values. The default values are provided in [square brackets].
Project to containerize:
[ProjectName (provide path to .csproj file)]Windows Server SKU to use:
[Windows Server Core (Default) or Windows Server Full]Windows Server version to use:
[2022, 2019, or 2016 (Default 2022)]Custom base image for the build stage of the Docker image ("None" to use standard Microsoft base image):
[Specify base image to use for build stage (Default None)]Custom base image for the run stage of the Docker image ("None" to use standard Microsoft base image):
[Specify base image to use for run stage (Default None)]Ports that must be exposed in the container image:
[e.g., 80][List any additional ports, or "None"]User account the container should run as:
[User account, or default to "ContainerUser"]IIS settings that must be configured in the container image:
[List any specific IIS settings, or "None"]Custom build steps that must be performed before building the container image:
[List any specific build steps, or "None"]Custom build steps that must be performed after building the container image:
[List any specific build steps, or "None"].NET assemblies that should be registered in the GAC in the container image:
[Assembly name and version, or "None"]MSIs that must be copied to the container image and installed:
[MSI names and versions, or "None"]COM components that must be registered in the container image:
[COM component names, or "None"]Registry keys and values that must be added to the container image:
[Registry paths and values, or "None"]Environment variables that must be set in the container image:
[Variable names and values, or "Use defaults"]Windows Server roles and features that must be installed in the container image:
[Role/feature names, or "None"]Files/directories that need to be copied to the container image:
[Paths relative to project root, or "None"][Container paths, or "Not applicable"]Files/directories to exclude from containerization:
[Paths to exclude, or "None"].dockerignore file (.dockerignore will already have common defaults; these are additional patterns):
[List any additional patterns, or "None"]Health check endpoint:
[Health check URL path, or "None"]Health check interval and timeout:
[Interval and timeout values, or "Use defaults"]Other instructions that must be followed to containerize the project:
[Specific requirements, or "None"]Known issues to address:
[Describe any known issues, or "None"]progress.md file to track changes with check marksTargetFrameworkVersion elementMicrosoft.Configuration.ConfigurationBuilders.Environmentweb.config file to add configuration builders section and settings to read app settings and connection strings from environment variables:
LogMonitorConfig.json file in the folder where the Dockerfile will be created by copying the reference LogMonitorConfig.json file at the end of this prompt. The file's contents MUST NOT not be modified and should match the reference content exactly unless instructions in containerization settings specify otherwise.
Information level for EventLog sources will cause unnecessary noise.mcr.microsoft.com/dotnet/framework/sdk base image unless a custom base image is specified in the settings filemcr.microsoft.com/dotnet/framework/aspnet base image unless a custom base image is specified in the settings fileLogMonitorConfig.json file to a directory in the container (e.g., C:\LogMonitor)ENTRYPOINT [ "C:\\LogMonitor\\LogMonitor.exe", "C:\\ServiceMonitor.exe", "w3svc" ].dockerignore file in the root of the project directory to exclude unnecessary files from the Docker image. The .dockerignore file MUST include at least the following elements as well as additional patterns as specified in the containerization settings:
<None Include="Dockerfile" />confirm that Docker build succeeds once the Dockerfile is completed. Use the following command to build the Docker image:
If the build fails, review the error messages and make necessary adjustments to the Dockerfile or project configuration. Report success/failure.
Maintain a progress.md file with the following structure:
Do not pause for confirmation between steps. Continue methodically until the application has been containerized and Docker build succeeds.
YOU ARE NOT DONE UNTIL ALL CHECKBOXES ARE MARKED! This includes building the Docker image successfully and addressing any issues that arise during the build process.
An example Dockerfile for an ASP.NET (.NET Framework) application using a Windows Server Core base image.
Note: Customize this template based on the specific requirements in the containerization settings.
When adapting this example Dockerfile:
YourSolution.sln, YourProject.csproj, etc. with your actual file namesAS stage-name syntax gives each stage a name--from=stage-name to copy files from a previous stageThe LogMonitorConfig.json file should be created in the root of the project directory. It is used to configure the LogMonitor tool, which monitors logs in the container. The contents of this file should look exactly like this to ensure proper logging functionality: