dockerfile-generator
Create, generate, or write Dockerfiles and multi-stage Docker images. Containerize apps.
What this skill does
# Dockerfile Generator ## Overview This skill provides a comprehensive workflow for generating production-ready Dockerfiles with security, optimization, and best practices built-in. Generates multi-stage builds, security-hardened configurations, and optimized layer structures with automatic validation and iterative error fixing. **Key Features:** - Multi-stage builds for optimal image size (50-85% reduction) - Security hardening (non-root users, minimal base images, no secrets) - Layer caching optimization for faster builds - Language-specific templates (Node.js, Python, Go, Java) - Automatic .dockerignore generation - Integration with `dockerfile-validator` for validation - Iterative validation and error fixing (minimum 1 iteration if errors found) - Local references plus docs lookup fallback chain for framework-specific patterns ## When to Use This Skill Invoke this skill when: - Creating new Dockerfiles from scratch - Containerizing applications (Node.js, Python, Go, Java, or other languages) - Implementing multi-stage builds for size optimization - Converting existing Dockerfiles to best practices - Generating production-ready container configurations - Optimizing Docker builds for security and performance - The user asks to "create", "generate", "build", or "write" a Dockerfile - Implementing containerization for microservices - Setting up CI/CD pipeline container builds ### Trigger Phrases Use this skill immediately when the request contains phrasing like: - "Generate a production Dockerfile for my app" - "Create a multi-stage Dockerfile for <language/framework>" - "Containerize this service with security best practices" - "Optimize this Dockerfile for size and build speed" - "Write Dockerfile and .dockerignore for deployment" ## Do NOT Use This Skill For - Validating existing Dockerfiles (use `dockerfile-validator` instead) - Building or running containers (use docker build/run commands) - Debugging running containers (use docker logs, docker exec) - Managing Docker images or registries ## Deterministic Execution Model Run these stages in order, and do not skip a stage unless the skip reason is reported in the final output. 1. Gather requirements (language, runtime version, entrypoint, exposed port, package manager, health endpoint). 2. Load references (local reference files first; external docs only when local references are insufficient). 3. Generate Dockerfile and `.dockerignore`. 4. Validate with `dockerfile-validator` or fallback local tools. 5. Iterate fixes until stop condition is met. 6. Publish final artifacts plus validation/audit report. Stop conditions for stage 5: - Stop when there are zero validation errors and no unapproved warnings. - Stop after 3 iterations maximum, then emit an intentional-deviation report for unresolved findings. ## Reference Path Map Consult these files directly by path as needed: - `references/security_best_practices.md` for non-root users, secret handling, base image hardening, vulnerability scanning. - `references/optimization_patterns.md` for multi-stage strategy, cache optimization, layer reduction, BuildKit cache mounts. - `references/language_specific_guides.md` for language/framework runtime and package-manager patterns. - `references/multistage_builds.md` for advanced stage-splitting and artifact-copy patterns. ## Dockerfile Generation Workflow Follow this workflow when generating Dockerfiles. Adapt based on user needs: ### Stage 1: Gather Requirements **Objective:** Understand what needs to be containerized and gather all necessary information. **Information to Collect:** 1. **Application Details:** - Programming language and version (Node.js 18/20, Python 3.11/3.12, Go 1.21+, Java 17/21, etc.) - Application type (web server, API, CLI tool, batch job, etc.) - Framework (Express, FastAPI, Spring Boot, etc.) - Entry point (main file, command to run) 2. **Dependencies:** - Package manager (npm/yarn/pnpm, pip/poetry, go mod, maven/gradle) - System dependencies (build tools, libraries, etc.) - Build-time vs runtime dependencies 3. **Application Configuration:** - Port(s) to expose - Environment variables needed - Configuration files - Health check endpoint (for web services) - Volume mounts (if any) 4. **Build Requirements:** - Build commands - Test commands (optional) - Compilation needs (for compiled languages) - Static asset generation 5. **Production Requirements:** - Expected image size constraints - Security requirements - Scaling needs - Resource constraints (CPU, memory) **Use AskUserQuestion if information is missing or unclear.** **Example Questions:** ``` - What programming language and version is your application using? - What is the main entry point to run your application? - Does your application expose any ports? If so, which ones? - Do you need any system dependencies beyond the base language runtime? - Does your application need a health check endpoint? ``` ### Stage 2: Framework/Library Documentation Lookup (if needed) **Objective:** Research framework-specific containerization patterns and best practices. **When to Perform This Stage:** - User mentions a specific framework (Next.js, Django, FastAPI, Spring Boot, etc.) - Application has complex build requirements - Need guidance on framework-specific optimization **Research Process (strict fallback chain):** 1. **Read local references first (required):** - `references/security_best_practices.md` - `references/optimization_patterns.md` - `references/language_specific_guides.md` 2. **Use Context7 docs lookup when local references are insufficient (preferred external source):** ``` Use mcp__context7__resolve-library-id with the framework name Then use mcp__context7__query-docs with query: "docker deployment production build" ``` 3. **Use web search only if Context7 is unavailable or missing needed details:** ``` "<framework>" "<version>" dockerfile production deployment best practices ``` 4. **If external lookup is unavailable (offline/tooling limits):** - Continue with local references and language templates in this file. - State assumptions explicitly in the output. - Mark the lookup limitation in the final report. 5. **Extract only actionable data:** - Recommended base image + version policy - Build optimization techniques - Required runtime environment variables - Production vs development differences - Security requirements specific to the framework ### Stage 3: Generate Dockerfile **Objective:** Create a production-ready, multi-stage Dockerfile following best practices. **Core Principles:** 1. **Multi-Stage Builds (REQUIRED for compiled languages, RECOMMENDED for all):** - Separate build stage from runtime stage - Keep build tools out of final image - Copy only necessary artifacts - Results in 50-85% smaller images 2. **Security Hardening (REQUIRED):** - Use specific version tags (NEVER use :latest) - Run as non-root user (create dedicated user) - Use minimal base images (alpine, distroless) - No hardcoded secrets - Scan base images for vulnerabilities 3. **Layer Optimization (REQUIRED):** - Order instructions from least to most frequently changing - Copy dependency files before application code - Combine related RUN commands with && - Clean up package manager caches in same layer - Leverage build cache effectively 4. **Production Readiness (REQUIRED):** - Add HEALTHCHECK for services - Use exec form for ENTRYPOINT/CMD - Set WORKDIR to absolute paths - Document exposed ports with EXPOSE **Language-Specific Templates:** #### Node.js Multi-Stage Dockerfile > **Build-stage dependency rule:** If the application has a build step (TypeScript, > Vite, Webpack, etc.), install **all** dependencies in the builder stage (omit > `--only=production`) and prune dev deps after the build. Using > `--only=production` before a build
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.