Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)40k · #7117

containerize-aspnetcore

Skill này làm gì

Công cụ này tạo các hướng dẫn cần thiết (gọi là Dockerfile) để biến dự án ASP.NET Core của bạn thành một “container”. Container là một gói biệt lập chứa mọi thứ ứng dụng cần để chạy, giúp triển khai dễ dàng ở các môi trường khác nhau.

Khi nào nên dùng

  • ✓Khi bạn muốn chạy ứng dụng ASP.NET Core trên máy chủ mà không phải cài đặt mọi thứ thủ công.
  • ✓Khi chuẩn bị ứng dụng để triển khai lên đám mây (như Azure, AWS, Google Cloud).
  • ✓Khi bạn cần đảm bảo ứng dụng hoạt động giống nhau trên mọi máy tính.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/containerize-aspnetcore/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo container cho dự án ASP.NET Core của tôi trong thư mục 'my-project/my-app.csproj', dùng .NET 8 và bản phân phối Alpine Linux.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ phân tích các thiết lập bạn cung cấp, như phiên bản .NET và loại Linux mong muốn. Dựa trên đó, nó tạo tệp Dockerfile, là hướng dẫn từng bước để build container cho ứng dụng của bạn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

  1. Project to containerize:

    • [ProjectName (provide path to .csproj file)]
  2. .NET version to use:

    • [8.0 or 9.0 (Default 8.0)]
  3. Linux distribution to use:

    • [debian, alpine, ubuntu, chiseled, or Azure Linux (mariner) (Default debian)]
  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., 8080]
    • Additional ports: [List any additional ports, or "None"]
  2. User account the container should run as:

    • [User account, or default to "$APP_UID"]
  3. Application URL configuration:

    • [Specify ASPNETCORE_URLS, or default to "http://+:8080"]

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"]
  3. NuGet package sources that must be configured:

    • [List any private NuGet feeds with authentication details, or "None"]

Dependencies

  1. System packages that must be installed in the container image:

    • [Package names for the chosen Linux distribution, or "None"]
  2. Native libraries that must be copied to the container image:

    • [Library names and paths, or "None"]
  3. Additional .NET tools that must be installed:

    • [Tool names and versions, or "None"]

System Configuration

  1. Environment variables that must be set in the container image:
    • [Variable names and values, or "Use defaults"]

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"]
  3. Volume mount points that should be configured:

    • [Volume paths for persistent data, 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 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))

…

Câu hỏi thường gặp

Container là gì?

Hãy hình dung container là một hộp tiêu chuẩn chứa ứng dụng và mọi thứ nó cần để hoạt động (mã, thư viện, thiết lập). Điều này đảm bảo nó chạy nhất quán ở mọi nơi.

Dockerfile là gì?

Đó là tệp văn bản chứa các chỉ dẫn mà Docker (công nghệ container) làm theo để build image container. Nó giống như công thức để tạo gói ứng dụng của bạn.

Tôi có cần biết nhiều về Docker để dùng công cụ này không?

Không. Công cụ này làm phần phức tạp thay bạn, bạn chỉ cần cung cấp các thiết lập cơ bản của dự án để tạo container.

Chi tiết

Mô tả gốc của tác giả

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

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7117
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự