containerize-aspnetcore
它能做什么
这个工具会生成把你的 ASP.NET Core 项目变成“容器”所需的指令(称为 Dockerfile)。容器就像一个隔离的打包盒,里面装着应用运行所需的一切,让它更容易部署到不同的环境中。
适用场景
- ✓当你想在服务器上运行 ASP.NET Core 应用,又不想手动安装各种依赖时。
- ✓当你准备把应用部署到云端时(比如 Azure、AWS、Google Cloud)。
- ✓当你需要确保应用在任何电脑上都能以相同方式运行时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/containerize-aspnetcore/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我的 ASP.NET Core 项目 'my-project/my-app.csproj' 创建容器,使用 .NET 8 和 Alpine Linux 发行版。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会分析你提供的设置,比如 .NET 版本和想要的 Linux 类型。基于这些信息,它会生成一个名为 Dockerfile 的文件,它就是构建你应用容器的分步指南。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
ASP.NET Core Docker Containerization Prompt
Containerization Request
Containerize the ASP.NET Core (.NET) project specified in the settings below, focusing exclusively on changes required for the application to run in a Linux Docker container. Containerization should consider all settings specified here.
Abide by best practices for containerizing .NET Core applications, ensuring that the container is optimized for performance, security, and maintainability.
Containerization Settings
This section of the prompt contains the specific settings and configurations required for containerizing the ASP.NET Core 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
Project to containerize:
[ProjectName (provide path to .csproj file)]
.NET version to use:
[8.0 or 9.0 (Default 8.0)]
Linux distribution to use:
[debian, alpine, ubuntu, chiseled, or Azure Linux (mariner) (Default debian)]
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)]
Container Configuration
Ports that must be exposed in the container image:
- Primary HTTP port:
[e.g., 8080] - Additional ports:
[List any additional ports, or "None"]
- Primary HTTP port:
User account the container should run as:
[User account, or default to "$APP_UID"]
Application URL configuration:
[Specify ASPNETCORE_URLS, or default to "http://+:8080"]
Build configuration
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"]
NuGet package sources that must be configured:
[List any private NuGet feeds with authentication details, or "None"]
Dependencies
System packages that must be installed in the container image:
[Package names for the chosen Linux distribution, or "None"]
Native libraries that must be copied to the container image:
[Library names and paths, or "None"]
Additional .NET tools that must be installed:
[Tool names and versions, or "None"]
System Configuration
- Environment variables that must be set in the container image:
[Variable names and values, or "Use defaults"]
File System
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"]
Files/directories to exclude from containerization:
[Paths to exclude, or "None"]
Volume mount points that should be configured:
[Volume paths for persistent data, or "None"]
.dockerignore Configuration
- Patterns to include in the
.dockerignorefile (.dockerignore will already have common defaults; these are additional patterns):- Additional patterns:
[List any additional patterns, or "None"]
- Additional patterns:
Health Check Configuration
Health check endpoint:
[Health check URL path, or "None"]
Health check interval and timeout:
[Interval and timeout values, or "Use defaults"]
Additional Instructions
Other instructions that must be followed to containerize the project:
[Specific requirements, or "None"]
Known issues to address:
[Describe any known issues, or "None"]
Scope
- ✅ App configuration modification to ensure application settings and connection strings can be read from environment variables
- ✅ Dockerfile creation and configuration for an ASP.NET Core application
- ✅ Specifying multiple stages in the Dockerfile to build/publish the application and copy the output to the final image
- ✅ Configuration of Linux container platform compatibility (Alpine, Ubuntu, Chiseled, or Azure Linux (Mariner))
…
常见问题
什么是容器?
可以把容器想象成一个标准化的盒子,里面包含你的应用以及它运行所需的一切(代码、库、设置)。这样它就能在任何地方一致地运行。
什么是 Dockerfile?
它是一个文本文件,里面写着 Docker(容器技术)构建容器镜像时要遵循的指令。可以把它看作用来打包你应用的“配方”。
使用这个工具需要很懂 Docker 吗?
不需要。这个工具隐藏了大部分复杂性,你只需要填写项目的基本设置,就能创建容器。
详情
作者的原始描述
Containerize an ASP.NET Core project by creating Dockerfile and .dockerfile files customized for the project.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7117
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。