containerize-aspnetcore

github/awesome-copilot · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/github/awesome-copilot --skill containerize-aspnetcore
0 commentsdiscussion
summary

Generate Dockerfile and .dockerignore files customized for ASP.NET Core containerization.

  • Accepts configurable settings for .NET version, Linux distribution (Debian, Alpine, Ubuntu, Chiseled, Azure Linux), base images, ports, and environment variables
  • Creates multi-stage Dockerfile with SDK build stage and optimized runtime stage, following Microsoft best practices for .NET containerization
  • Generates .dockerignore file with sensible defaults (bin/, obj/, .git/, etc.) plus custom patt
skill.md

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))
  • ✅ Proper handling of dependencies (system packages, native libraries, additional tools)
  • ❌ No infrastructure setup (assumed to be handled separately)
  • ❌ No code changes beyond those required for containerization

Execution Process

  1. Review the containerization settings above to understand the containerization requirements
  2. Create a progress.md file to track changes with check marks
  3. Determine the .NET version from the project's .csproj file by checking the TargetFramework element
  4. Select the appropriate Linux container image based on:
  5. Create a Dockerfile in the root of the project directory to containerize the application
    • The Dockerfile should use multiple stages:
      • Build stage: Use a .NET SDK image to build the application
        • Copy csproj file(s) first
        • Copy NuGet.config if one exists and configure any private feeds
        • Restore NuGet packages
        • Then, copy the rest of the source code and build and publish the application to /app/publish
      • Final stage: Use the selected .NET runtime image to run the application
        • Set the working directory to /app
        • Set the user as directed (by default, to a non-root user (e.g., $APP_UID))
          • Unless directed otherwise in containerization settings, a new user does not need to be created. Use the $APP_UID variable to specify the user account.
        • Copy the published output from the build stage to the final image
    • Be sure to consider all requirements in the containerization settings:
      • .NET version and Linux distribution
      • Exposed ports
      • User account for container
      • ASPNETCORE_URLS configuration
      • System package installation
      • Native library dependencies
      • Additional .NET tools
      • Environment variables
      • File/directory copying
      • Volume mount points
      • Health check configuration
  6. Create a .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:
    • bin/
    • obj/
    • .dockerignore
    • Dockerfile
    • .git/
    • .github/
    • .vs/
    • .vscode/
    • **/node_modules/
    • *.user
    • *.suo
    • **/.DS_Store
    • **/Thumbs.db
    • Any additional patterns specified in the containerization settings
  7. Configure health checks if specified in the containerization settings:
    • Add HEALTHCHECK instruction to Dockerfile if health check endpoint is provided
    • Use curl or wget to check the health endpoint
  8. Mark tasks as completed: [ ] → [✓]
  9. Continue until all tasks are complete and Docker build succeeds

Build and Runtime Verification

Confirm that Docker build succeeds once the Dockerfile is completed. Use the following command to build the Docker image:

docker build -t aspnetcore-app:latest .

If the build fails, review the error messages and make necessary adjustments to the Dockerfile or project configuration. Report success/failure.

Progress Tracking

Maintain a progress.md file with the following structure:

# Containerization Progress

## Environment Detection
- [ ] .NET version detection (version: ___)
- [ ] Linux distribution selection (distribution: ___)

## Configuration Changes
- [ ] Application configuration verification for environment variable support
- [ ] NuGet package source configuration (if applicable)

## Containerization
- [ ] Dockerfile creation
- [ ] .dockerignore file creation
- [ ] Build stage created with SDK image
- [ ] csproj file(s) copied for package restore
- [ ] NuGet.config copied if applicable
- [ ] Runtime stage created with runtime image
- [ ] Non-root user configuration
- [ ] Dependency handling (system packages, native libraries, tools, etc.)
- [ ] Health check configuration (if applicable)
- [ ] Special requirements implementation

## Verification
- [ ] Review containerization settings and make sure that all requirements are met
- [ ] Docker build success

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.

Example Dockerfile

An example Dockerfile for an ASP.NET Core (.NET) application using a Linux base image.

# ============================================================
# Stage 1: Build and publish the application
# ============================================================

# Base Image - Select the appropriate .NET SDK version and Linux distribution
# Possible tags include:
# - 8.0-bookworm-slim (Debian 12)
# - 8.0-noble (Ubuntu 24.04)
# - 8.0-alpine (Alpine Linux)
# - 9.0-bookworm-slim (Debian 12)
# - 9.0-noble (Ubuntu 24.04)
# - 9.0-alpine (Alpine Linux)
# Uses the .NET SDK image for building the application
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
ARG BUILD_CONFIGURATION=Release

WORKDIR /src

# Copy project files first for better caching
COPY ["YourProject/YourProject.csproj", "YourProject/"]
COPY ["YourOtherProject/YourOtherProject.csproj", "YourOtherProject/"]

# Copy NuGet configuration if it exists
COPY ["NuGet.config", "."]

# Restore NuGet packages
RUN dotnet restore "YourProject/YourProject.csproj"

# Copy source code
COPY . .

# Perform custom pre-build steps here, if needed
# RUN echo "Running pre-build steps..."

# Build and publish the application
WORKDIR "/src/YourProject"
RUN dotnet build "YourProject.csproj" -c $BUILD_CONFIGURATION -o /app/build

# Publish the application
RUN dotnet publish "YourProject.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

# Perform custom post-build steps here, if needed
# RUN echo "Running post-build steps..."

# ============================================================
# Stage 2: Final runtime image
# ============================================================

# Base Image - Select the appropriate .NET runtime version and Linux distribution
# Possible tags include:
# - 8.0-bookworm-slim (Debian 12)
# - 8.0-noble (Ubuntu 24.04)
# - 8.0-alpine (Alpine Linux)
# - 8.0-noble-chiseled (Ubuntu 24.04 Chiseled)
# - 8.0-azurelinux3.0 (Azure Linux)
# - 9.0-bookworm-slim (Debian 12)
# - 9.0-noble (Ubuntu 24.04)
# - 9.0-alpine (Alpine Linux)
# - 9.0-noble-chiseled (Ubuntu 24.04 Chiseled)
# - 9.0-azurelinux3.0 (Azure Linux)
# Uses the .NET runtime image for running the application
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS final

# Install system packages if needed (uncomment and modify as needed)
# RUN apt-get update && apt-get install -y \
#     curl \
#     wget \
#     ca-certificates \
#     libgdiplus \
#     && rm -rf /var/lib/apt/lists/*

# Install additional .NET tools if needed (uncomment and modify as needed)
# RUN dotnet tool install --global dotnet-ef --version 8.0.0
# ENV PATH="$PATH:/root/.dotnet/tools"

WORKDIR /app

# Copy published application from build stage
COPY --from=build /app/publish .

# Copy additional files if needed (uncomment and modify as needed)
# COPY ./config/appsettings.Production.json .
# COPY ./certificates/ ./certificates/

# Set environment variables
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:8080

# Add custom environment variables if needed (uncomment and modify as needed)
# ENV CONNECTION
how to use containerize-aspnetcore

How to use containerize-aspnetcore on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add containerize-aspnetcore
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/github/awesome-copilot --skill containerize-aspnetcore

The skills CLI fetches containerize-aspnetcore from GitHub repository github/awesome-copilot and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/containerize-aspnetcore

Reload or restart Cursor to activate containerize-aspnetcore. Access the skill through slash commands (e.g., /containerize-aspnetcore) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.636 reviews
  • Naina Mehta· Dec 28, 2024

    Solid pick for teams standardizing on skills: containerize-aspnetcore is focused, and the summary matches what you get after install.

  • Shikha Mishra· Dec 20, 2024

    containerize-aspnetcore has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Alexander Choi· Dec 20, 2024

    Registry listing for containerize-aspnetcore matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Lucas Desai· Dec 16, 2024

    containerize-aspnetcore is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Charlotte Flores· Dec 12, 2024

    containerize-aspnetcore fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Meera Smith· Nov 19, 2024

    I recommend containerize-aspnetcore for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Rahul Santra· Nov 11, 2024

    containerize-aspnetcore reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Lucas Patel· Nov 7, 2024

    Keeps context tight: containerize-aspnetcore is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Yusuf Kapoor· Nov 3, 2024

    We added containerize-aspnetcore from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Aisha Yang· Oct 26, 2024

    I recommend containerize-aspnetcore for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 36

1 / 4