Skip to content
Skills Library
DevOps & cloud · Building & coding

dockerfile-generator

/dockerfile-generator

Generate an optimized multi-stage Dockerfile and .dockerignore for a .NET app — small final image, layer caching, non-root user, and best practices. Use this skill whenever the user wants a Dockerfile, to containerize a .NET app, a multi-stage build, smaller images, chiseled/distroless images, or asks "how do I dockerize this / Dockerfile for .NET / shrink my image". Always use this skill for Dockerfile requests; it produces a production-grade multi-stage build.

Licence
MIT
Last repository change
09.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 09.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Generate an optimized multi-stage Dockerfile and .dockerignore for a .NET app — small final image, layer caching, non-root user, and best practices. Use this skill whenever the user wants a Dockerfile, to containerize a .NET app, a multi-stage build, smaller images, chiseled/distroless images, or asks "how do I dockerize this / Dockerfile for .NET / shrink my image". Always use this skill for Dockerfile requests; it produces a production-grade multi-stage build.

Original author description

Generate an optimized multi-stage Dockerfile and .dockerignore for a .NET app — small final image, layer caching, non-root user, and best practices. Use this skill whenever the user wants a Dockerfile, to containerize a .NET app, a multi-stage build, smaller images, chiseled/distroless images, or asks "how do I dockerize this / Dockerfile for .NET / shrink my image". Always use this skill for Dockerfile requests; it produces a production-grade multi-stage build.

How it works

  1. Input — point it at your project
  2. Multi-stage Dockerfile
  3. .dockerignore (don't ship junk / bloat context)
  4. Image-size options (smallest → most compatible)
  5. Principles
  6. How to use it & best prompts
Original SKILL.md headings · 53 lines, 285 words
SKILL.md preview
---
name: dockerfile-generator
description: Generate an optimized multi-stage Dockerfile and .dockerignore for a .NET app — small final image, layer caching, non-root user, and best practices. Use this skill whenever the user wants a Dockerfile, to containerize a .NET app, a multi-stage build, smaller images, chiseled/distroless images, or asks "how do I dockerize this / Dockerfile for .NET / shrink my image". Always use this skill for Dockerfile requests; it produces a production-grade multi-stage build.
category: DevOps
version: 1.0.0
---

# Dockerfile Generator

Produce a production-grade multi-stage Dockerfile for a .NET app: fast cached builds, a small secure runtime image, and a non-root user.

## Input — point it at your project
Works on a target: a **project/solution** or **GitHub URL**. Detect the entry project and TFM: `find <target> -name "*.csproj"` and read `<TargetFramework>`. Note solution layout for correct copy/restore.

## Multi-stage Dockerfile
```dockerfile
# build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY ["MyApp/MyApp.csproj", "MyApp/"]
RUN dotnet restore "MyApp/MyApp.csproj"          # restore as its own layer = cached unless csproj changes
COPY . .
RUN dotnet publish "MyApp/MyApp.csproj" -c Release -o /app/publish /p:UseAppHost=false

# runtime (small + non-root)
FROM mcr.microsoft.com/dotnet/aspnet:9.0-noble-chiseled AS final
WORKDIR /app
COPY --from=build /app/publish .
USER $APP_UID                                     # non-root (chiseled images set this)
EXPOSE 8080
ENTRYPOINT ["dotnet", "MyApp.dll"]
```

## .dockerignore (don't ship junk / bloat context)
```
**/bin/
**/obj/
**/.vs/
**/.git/
**/*.user
Dockerfile*
```

## Image-size options (smallest → most compatible)
- **`-chiseled`** — minimal, no shell, non-root by default. Best default for services.
- **`-alpine`** — small, musl libc (watch native deps).
- **`-noble`/standard** — largest, most compatible.
- **AOT + `runtime-deps`** for tiny self-contained images when the app is AOT-compatible.

## Principles
- **Restore before copying source** so dependency layers cache (huge build-time win).
- **Run as non-root** — chiseled images do this for you.
- **Smallest base that runs your app** — chiseled/distroless reduce attack surface.
- Keep the build context lean with `.dockerignore`.
- Pin base image tags; don't use `latest` in production.

## How to use it & best prompts
"Dockerize this .NET app", "give me a multi-stage Dockerfile", "shrink my image / use a chiseled image", "non-root container for my service". Pairs with `cicd-pipeline-generator` and `microservice-template-generator`.
Files in this package (2)
  • SKILL.md 3 KB
  • USAGE.md 1 KB

Versions

RepositoryScoreLicence
This page · stefanthecode/dotnet-ai-toolkit100MIT
jeremylongshore/tons-of-skills-marketplace100MIT
hamzafarooq/claude-code-starter100MIT
pantheon-org/tekhne90MIT

Database snapshot: 13.11.2026 · package version 31b62b5dd2be (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100dockerize
    Containerizes an application with a small, secure, production-grade Dockerfile (multi-stage build, pinned base image, non-root user, layer caching, healthcheck) plus .dockerignore and an optional compose file for local development. Use when the user asks to dockerize,…
  • 100container-publish
    Dockerfile-less containerization using the .NET 10 SDK container publishing feature. Covers MSBuild properties, chiseled images, multi-arch builds, and registry publishing — all without writing a Dockerfile. Load this skill when the user wants to containerize without a…
  • 100docker-expert
    Expert Docker: Dockerfiles, multi-stage builds, image size/cache optimization, Compose, and container best practices. Trigger keywords: Docker, Dockerfile, container, image, multi-stage, layer cache, docker-compose, .dockerignore, entrypoint, distroless, non-root, healthcheck,…
  • 100dockerize
    Generate an optimized, production-ready Dockerfile for any project. Detects language and framework, uses multi-stage builds, optimizes layer caching, handles monorepo structures, and follows security best practices. Use when the user says "dockerize", "add docker", "create…
  • 100docker-image-create
    Generate production-ready Dockerfiles from project source code. Detects language/framework automatically and produces multi-stage builds with minimal, distroless, or slim base images. Use this skill whenever the user wants to containerize an application, create a Dockerfile,…
  • 100docker
    Docker containerization for .NET 10 applications. Covers multi-stage builds, .NET container images, non-root user configuration, health checks, and .dockerignore. Load this skill when containerizing an application with a Dockerfile, optimizing image size, setting up Docker…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.