Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Containerize an ASP.NET Core project by creating Dockerfile and .dockerfile files customized for the project.
.claude/skills/containerize-aspnetcore/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | — | — |
| case-05 | ✗→✓ | ▲ Improved | — | — |
| case-15 | ✗→✓ | ▲ Improved | — | — |
| case-12 | ✗→✗ | = Same ✗ | — | — |
| case-14 | ✗→✗ | = Same ✗ | — | — |
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.
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].
[ProjectName (provide path to .csproj file)][8.0 or 9.0 (Default 8.0)][debian, alpine, ubuntu, chiseled, or Azure Linux (mariner) (Default debian)][Specify base image to use for build stage (Default None)][Specify base image to use for run stage (Default None)] [e.g., 8080][List any additional ports, or "None"][User account, or default to "$APP_UID"][Specify ASPNETCORE_URLS, or default to "http://+:8080"][List any specific build steps, or "None"][List any specific build steps, or "None"][List any private NuGet feeds with authentication details, or "None"][Package names for the chosen Linux distribution, or "None"][Library names and paths, or "None"][Tool names and versions, or "None"][Variable names and values, or "Use defaults"][Paths relative to project root, or "None"][Container paths, or "Not applicable"][Paths to exclude, or "None"][Volume paths for persistent data, or "None"].dockerignore file (.dockerignore will already have common defaults; these are additional patterns):[List any additional patterns, or "None"][Health check URL path, or "None"][Interval and timeout values, or "Use defaults"][Specific requirements, or "None"][Describe any known issues, or "None"]progress.md file to track changes with check marksTargetFramework element$APP_UID))$APP_UID variable to specify the user account..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:Confirm that Docker build succeeds once the Dockerfile is completed. Use the following command to build the Docker image:
bashdocker 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.
Maintain a progress.md file with the following structure:
markdown# 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.
An example Dockerfile for an ASP.NET Core (.NET) application using a Linux base image.
dockerfile# ============================================================ # 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 CONNECTIONSTRINGS__DEFAULTCONNECTION="your-connection-string" # ENV FEATURE_FLAG_ENABLED=true # Configure SSL/TLS certificates if needed (uncomment and modify as needed) # ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/app/certificates/app.pfx # ENV ASPNETCORE_Kestrel__Certificates__Default__Password=your_password # Expose the port the application listens on EXPOSE 8080 # EXPOSE 8081 # Uncomment if using HTTPS # Install curl for health checks if not already present RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* # Configure health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # Create volumes for persistent data if needed (uncomment and modify as needed) # VOLUME ["/app/data", "/app/logs"] # Switch to non-root user for security USER $APP_UID # Set the entry point for the application ENTRYPOINT ["dotnet", "YourProject.dll"]
Note: Customize this template based on the specific requirements in containerization settings.
When adapting this example Dockerfile:
YourProject.csproj, YourProject.dll, etc. with your actual project namesFor smaller image sizes, you can use Alpine Linux:
dockerfileFROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build # ... build steps ... FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final # Install packages using apk RUN apk update && apk add --no-cache curl ca-certificates
For minimal attack surface, consider using chiseled images:
dockerfileFROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS final # Note: Chiseled images have minimal packages, so you may need to use a different base for additional dependencies
For Azure-optimized containers:
dockerfileFROM mcr.microsoft.com/dotnet/aspnet:8.0-azurelinux3.0 AS final # Install packages using tdnf RUN tdnf update -y && tdnf install -y curl ca-certificates && tdnf clean all
AS stage-name syntax gives each stage a name--from=stage-name to copy files from a previous stagefinal stage is the one that becomes the final container imagelatest| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 11 counted toward the lift figure. The other 11 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +14 percentage points is the difference between those two pass rates over the 11 comparable cases. 8 cases got worse with the skill loaded, and they are included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.