ワンクリックで
planforge-new-dockerfile
Scaffold a multi-stage Dockerfile for .NET with optimized layer caching, non-root user, and distroless runtime.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Scaffold a multi-stage Dockerfile for .NET with optimized layer caching, non-root user, and distroless runtime.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Run a comprehensive code review across architecture, security, testing, naming, and patterns. Invokes relevant reviewer agents in sequence. Use before merging features or at the end of a phase. With --quorum, dispatches multi-model analysis for higher confidence.
Audit UI components for WCAG 2.2 compliance, semantic HTML, ARIA labels, keyboard navigation, color contrast, and responsive design.
Audit API endpoints for backward compatibility, versioning, OpenAPI compliance, pagination, rate limiting, and RFC 9457 error responses.
Review code for architecture violations: layer separation, sync-over-async, missing CancellationToken, improper DI. Use for PR reviews or code audits.
Fix a bug using TDD: reproduce with a failing test first, then implement the fix, then verify. Prevents regressions.
Review CI/CD pipelines for best practices: environment promotion, secrets management, rollback strategies, build caching, and deployment safety.
| name | planforge-new-dockerfile |
| description | Scaffold a multi-stage Dockerfile for .NET with optimized layer caching, non-root user, and distroless runtime. |
| metadata | {"author":"plan-forge","source":".github/prompts/new-dockerfile.prompt.md"} |
Scaffold a production-grade multi-stage Dockerfile for a .NET application.
# ---- Build Stage ----
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /src
# Copy csproj files first for layer caching
COPY *.sln ./
COPY src/{ProjectName}/*.csproj src/{ProjectName}/
COPY tests/{ProjectName}.Tests/*.csproj tests/{ProjectName}.Tests/
RUN dotnet restore
# Copy everything else and build
COPY . .
RUN dotnet publish src/{ProjectName}/{ProjectName}.csproj \
-c Release \
-o /app/publish \
--no-restore \
/p:UseAppHost=false
# ---- Runtime Stage ----
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS runtime
WORKDIR /app
# Security: run as non-root
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
COPY --from=build /app/publish .
EXPOSE 8080
ENV ASPNETCORE_URLS=http://+:8080
ENV DOTNET_EnableDiagnostics=0
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
ENTRYPOINT ["dotnet", "{ProjectName}.dll"]
**/bin/
**/obj/
**/node_modules/
**/.vs/
**/.vscode/
**/Dockerfile*
**/.dockerignore
**/.git
**/.gitignore
*.md
services:
api:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__Default=Host=db;Database=mydb;Username=postgres;Password=postgres
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: mydb
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
volumes:
pgdata:
.csproj/.sln first for layer caching before COPY . ..dockerignore to exclude build artifacts and secrets--no-restore on dotnet publish when restore was done separately