Skip to content
Development
Agent

dockerfile-generator

Generates optimized, production-ready Dockerfiles for any language/framework with multi-stage builds, security best practices, and proper caching.

From plugin
f5-framework
24104 skills104 agents69 commands

Claude Code

> /plugin marketplace add Fujigo-Software/f5-framework-claude

Agent definition

dockerfile-generator.md

Dockerfile Generator Agent

Purpose

Generates optimized, production-ready Dockerfiles for any language/framework with multi-stage builds, security best practices, and proper caching.

Activation

  • User requests: "create dockerfile", "dockerize this app", "generate docker config"
  • Project contains: package.json, requirements.txt, go.mod, pom.xml, Cargo.toml
  • Commands: `/docker:generate`, `/docker:dockerfile`

Capabilities

Language Detection

Automatically detects project language and framework:

  • **Node.js**: package.json, yarn.lock, pnpm-lock.yaml
  • **Python**: requirements.txt, Pipfile, pyproject.toml, setup.py
  • **Go**: go.mod, go.sum
  • **Java**: pom.xml, build.gradle
  • **Rust**: Cargo.toml
  • **.NET**: *.csproj, *.sln

Multi-Stage Build Generation

Creates optimized multi-stage Dockerfiles: 1. **Dependencies stage**: Install and cache dependencies 2. **Builder stage**: Compile/build application 3. **Development stage**: Hot reload setup 4. **Production stage**: Minimal runtime image

Security Best Practices

  • Non-root user creation
  • Minimal base images (alpine, slim, distroless)
  • No secrets in image
  • Health checks
  • Proper signal handling

Input Requirements

required:
  - project_type: "node|python|go|java|rust|dotnet"

optional:
  - node_version: "20"
  - python_version: "3.12"
  - go_version: "1.22"
  - java_version: "21"
  - base_image: "alpine|slim|distroless"
  - port: 3000
  - has_healthcheck: true
  - include_dev_stage: true

Output Format

Generated Dockerfile Structure

# =============================================================================
# Multi-Stage Dockerfile for {{project_type}}
# Generated by F5 Framework
# =============================================================================

# Build arguments
ARG {{LANG}}_VERSION={{version}}

# Stage 1: Dependencies
FROM {{base_image}} AS deps
# ... dependency installation

# Stage 2: Builder
FROM {{base_image}} AS builder
# ... build process

# Stage 3: Development (optional)
FROM {{base_image}} AS development
# ... dev setup with hot reload

# Stage 4: Production
FROM {{base_image}} AS production
# ... minimal production image

Generated .dockerignore

# Generated .dockerignore
.git
node_modules
__pycache__
.env*
*.log
Dockerfile*
docker-compose*
README.md
docs/
test/
coverage/

Generation Rules

Node.js Projects

detect_package_manager:
  - npm: package-lock.json
  - yarn: yarn.lock
  - pnpm: pnpm-lock.yaml

install_command:
  npm: "npm ci --only=production"
  yarn: "yarn --frozen-lockfile --production"
  pnpm: "pnpm install --frozen-lockfile --prod"

base_images:
  default: "node:20-alpine"
  with_native_deps: "node:20-slim"

Python Projects

detect_dependency_manager:
  - pip: requirements.txt
  - pipenv: Pipfile
  - poetry: pyproject.toml

virtual_env: "/opt/venv"

base_images:
  default: "python:3.12-slim"
  with_c_extensions: "python:3.12-bookworm"

Go Projects

build_flags: >
  CGO_ENABLED=0 GOOS=linux GOARCH=amd64
  -ldflags='-w -s -extldflags "-static"'

base_images:
  build: "golang:1.22-alpine"
  runtime: "gcr.io/distroless/static-debian12"

Java Projects

detect_build_tool:
  - maven: pom.xml
  - gradle: build.gradle

layer_extraction: true  # Use Spring Boot layertools

base_images:
  build: "eclipse-temurin:21-jdk-alpine"
  runtime: "eclipse-temurin:21-jre-alpine"

jvm_options: >
  -XX:+UseContainerSupport
  -XX:MaxRAMPercentage=75.0

Example Generation

Input

project_type: node
framework: nestjs
port: 3000
include_dev_stage: true
has_healthcheck: true

Output

# =============================================================================
# Multi-Stage Dockerfile for NestJS Application
# =============================================================================
ARG NODE_VERSION=20

# Stage 1: Dependencies
FROM node:${NODE_VERSION}-alpine AS deps
WORKDIR /app
RUN apk add --no-cache libc6-compat
COPY package.json package-lock.json* ./
RUN npm ci && npm cache clean --force

# Stage 2: Builder
FROM node:${NODE_VERSION}-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
RUN npm prune --production

# Stage 3: Development
FROM node:${NODE_VERSION}-alpine AS development
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
EXPOSE 3000
CMD ["npm", "run", "start:dev"]

# Stage 4: Production
FROM node:${NODE_VERSION}-alpine AS production
WORKDIR /app
ENV NODE_ENV=production

RUN addgroup --system --gid 1001 nodejs && \
    adduser --system --uid 1001 appuser

COPY --from=builder --chown=appuser:nodejs /app/dist ./dist
COPY --from=builder --chown=appuser:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=appuser:nodejs /app/package.json ./

USER appuser
EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1

CMD ["node", "dist/main.js"]

Validation Checklist

Before finalizing Dockerfile:

  • [ ] Uses specific base image version (not :latest)
  • [ ] Multi-stage build separates build and runtime
  • [ ] Non-root user created and used
  • [ ] Health check included
  • [ ] .dockerignore generated
  • [ ] Dependencies cached before source code
  • [ ] Cleanup in same RUN layer
  • [ ] No secrets embedded

Related Skills

  • dockerfile/multi-stage-builds
  • dockerfile/best-practices
  • dockerfile/layer-optimization
  • security/image-security
Read more
@fujigo-software
Ships withf5-framework

AI-Powered Development Framework for Claude Code

2434 skills104 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
24
Star history of Fujigo-Software/f5-framework-claude on GitHub, a chart by star-history.com

Other agents on f5-framework.

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc12d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react1d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex1d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman2d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about dockerfile-generator.

Which coding agents can use dockerfile-generator?
dockerfile-generator installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.