What problem does it solve?
This Skill enforces Dockerfile and Docker Compose best practices to produce secure, small, and cache-efficient container images while avoiding common pitfalls like running as root, poor layer caching, missing health checks, and improper Compose syntax.
Core Features & Use Cases
- Multi-stage build guidance with .NET-specific conventions: separate build and runtime stages, use sdk for build and aspnet/runtime for final stage, and keep versions aligned.
- Layer caching and .dockerignore recommendations: copy project files individually to maximize restore cache hits, place infrequently changed steps earlier, and exclude build artifacts from context.
- Runtime safety and deployment readiness: enforce non-root execution, include HEALTHCHECK instructions, avoid hard-coded secrets, and require explicit, versioned image tags plus Compose Specification v2 compliance for CI and production deployments.
- Use Case: Harden a multi-project .NET solution Dockerfile and compose manifests for CI pipelines and production deployment.
Quick Start
Create a multi-stage Dockerfile for a .NET web app that copies each project file then restores to preserve cache, uses matching sdk and runtime images, switches to a non-root user, includes a HEALTHCHECK, and produce a Compose v2 service with explicit versioned image tags.