跳到正文
Skillpedia
部署与云(DevOps)40k · #7116

containerize-aspnet-framework

它能做什么

这个工具会生成把 ASP.NET .NET Framework 项目变成容器所需的指令(称为 Dockerfile)。这样你的应用就能在任何地方保持一致地运行。

适用场景

  • ✓当你想在另一台服务器上运行你的 ASP.NET 应用时。
  • ✓当你准备把应用部署到云端时。
  • ✓为了确保你的应用在不同的测试环境中表现一致。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/containerize-aspnet-framework/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/containerize-aspnet-framework/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我为位于 'C:\myproject\myproject.csproj' 的 ASP.NET 项目创建容器,使用 Windows Server 2022 Core,并暴露端口 80。”

每周 5 个新技能,1 分钟读完。

工作原理

工具会分析你提供的设置,比如项目路径和端口。然后它会生成一个名为 Dockerfile 的文件,其中包含在隔离环境(容器)中构建和运行你的应用所需的全部命令。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

ASP.NET .NET Framework Containerization Prompt

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.

Containerization Settings

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].

Basic Project Information

  1. Project to containerize:

    • [ProjectName (provide path to .csproj file)]
  2. Windows Server SKU to use:

    • [Windows Server Core (Default) or Windows Server Full]
  3. Windows Server version to use:

    • [2022, 2019, or 2016 (Default 2022)]
  4. 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)]
  5. 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)]

Container Configuration

  1. Ports that must be exposed in the container image:

    • Primary HTTP port: [e.g., 80]
    • Additional ports: [List any additional ports, or "None"]
  2. User account the container should run as:

    • [User account, or default to "ContainerUser"]
  3. IIS settings that must be configured in the container image:

    • [List any specific IIS settings, or "None"]

Build configuration

  1. Custom build steps that must be performed before building the container image:

    • [List any specific build steps, or "None"]
  2. Custom build steps that must be performed after building the container image:

    • [List any specific build steps, or "None"]

Dependencies

  1. .NET assemblies that should be registered in the GAC in the container image:

    • [Assembly name and version, or "None"]
  2. MSIs that must be copied to the container image and installed:

    • [MSI names and versions, or "None"]
  3. COM components that must be registered in the container image:

    • [COM component names, or "None"]

System Configuration

  1. Registry keys and values that must be added to the container image:

    • [Registry paths and values, or "None"]
  2. Environment variables that must be set in the container image:

    • [Variable names and values, or "Use defaults"]
  3. Windows Server roles and features that must be installed in the container image:

    • [Role/feature names, or "None"]

File System

  1. Files/directories that need to be copied to the container image:

    • [Paths relative to project root, or "None"]
    • Target location in container: [Container paths, or "Not applicable"]
  2. Files/directories to exclude from containerization:

    • [Paths to exclude, or "None"]

.dockerignore Configuration

  1. Patterns to include in the .dockerignore file (.dockerignore will already have common defaults; these are additional patterns):
    • Additional patterns: [List any additional patterns, or "None"]

Health Check Configuration

  1. Health check endpoint:

    • [Health check URL path, or "None"]
  2. Health check interval and timeout:

    • [Interval and timeout values, or "Use defaults"]

Additional Instructions

  1. Other instructions that must be followed to containerize the project:

    • [Specific requirements, or "None"]
  2. Known issues to address:

    • [Describe any known issues, or "None"]

Scope

  • ✅ App configuration modification to ensure config builders are used to read app settings and connection strings from the environment variables
  • ✅ Dockerfile creation and configuration for an ASP.NET application
  • ✅ Specifying multiple stages in the Dockerfile to build/publish the application and copy the output to the final image
  • ✅ Configuration of Windows container platform compatibility (Windows Server Core or Full)

…

常见问题

什么是容器?

容器就像一个轻量级的隔离盒子,里面装着应用运行所需的一切:代码、库和设置。这样无论在哪台电脑上,它的运行方式都一样。

.NET Framework 和 .NET Core 有什么区别?

.NET Framework 是较旧的版本,通常用于 Windows 系统。.NET Core(现在就叫 .NET)更现代、跨平台且更灵活。这个工具专门针对 .NET Framework。

使用前需要先安装什么吗?

需要。项目必须已安装 NuGet 包 'Microsoft.Configuration.ConfigurationBuilders.Environment'。如果没有安装,你需要在使用这个工具之前,先在 Visual Studio 中手动安装它。

详情

作者的原始描述

Containerize an ASP.NET .NET Framework project by creating Dockerfile and .dockerfile files customized for the project.

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7116
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能