/containerize
Production-ready containerization orchestrator with multi-stage builds, security hardening, and Kubernetes optimization
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/containerize
Context preview
What this command does when you run it.
Production-ready containerization orchestrator with multi-stage builds, security hardening, and Kubernetes optimization
Command definition
containerize.mdallowed-tools: Task, Read, Write, Edit, MultiEdit, Bash(fd:*), Bash(rg:*), Bash(eza:*), Bash(bat:*), Bash(jq:*), Bash(gdate:*), Bash(docker:*), Bash(kubectl:*), Bash(mvn:*), Bash(gradle:*), Bash(cargo:*), Bash(go:*)
name: "Containerize"
description: "Production-ready containerization orchestrator with multi-stage builds, security hardening, and Kubernetes optimization"
author: "wcygan"
tags: ["ops","deploy"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"
Context
- Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
- Target project: $ARGUMENTS
- Current directory: !`pwd`
- Project structure: !`eza -la --tree --level=2 2>/dev/null | head -15 || fd . -t d -d 2 | head -10`
- Build files detected: !`fd "(Dockerfile|docker-compose|package\.json|Cargo\.toml|go\.mod|pom\.xml|build\.gradle|deno\.json)" . -d 3 | head -10 || echo "No build files detected"`
- Container tools status: !`echo "docker: $(which docker >/dev/null && echo ✓ || echo ✗) | kubectl: $(which kubectl >/dev/null && echo ✓ || echo ✗) | hadolint: $(which hadolint >/dev/null && echo ✓ || echo ✗)"`
- Existing containers: !`docker ps -a --format "table {{.Names}}\t{{.Image}}\t{{.Status}}" 2>/dev/null | head -5 || echo "No Docker daemon or containers found"`
Your Task
STEP 1: Initialize containerization session and analyze project architecture
- CREATE session state file: `/tmp/containerize-session-$SESSION_ID.json`
- ANALYZE project structure and technology stack from Context section
- DETECT primary and secondary languages/frameworks
- IDENTIFY existing containerization (Dockerfile, docker-compose.yml, K8s manifests)
# Initialize containerization session state
echo '{
"sessionId": "'$SESSION_ID'",
"targetProject": "'$ARGUMENTS'",
"detectedTechnologies": [],
"containerStrategy": "auto-detect",
"securityProfile": "production",
"deploymentTarget": "kubernetes"
}' > /tmp/containerize-session-$SESSION_ID.jsonSTEP 2: Comprehensive project analysis with parallel sub-agent coordination
TRY:
IF project_complexity == "multi-service" OR technology_stack == "polyglot":
LAUNCH parallel sub-agents for comprehensive project analysis:
- **Agent 1: Technology Stack Analysis**: Analyze all build files, dependencies, and frameworks
- Focus: Package managers, runtime requirements, build tools, version constraints
- Tools: fd for file discovery, rg for dependency searches, language-specific tools
- Output: Technology manifest with build requirements and constraints
- **Agent 2: Security & Compliance Assessment**: Evaluate security requirements and compliance needs
- Focus: Secrets management, network policies, security contexts, vulnerability scanning
- Tools: rg for credential patterns, static analysis of existing configurations
- Output: Security profile and hardening recommendations
- **Agent 3: Performance & Optimization**: Analyze performance requirements and optimization opportunities
- Focus: Build caching, layer optimization, resource requirements, scaling patterns
- Tools: Analysis of build artifacts, dependency graphs, performance bottlenecks
- Output: Optimization strategy and resource allocation recommendations
- **Agent 4: Deployment Architecture**: Design deployment strategy and infrastructure requirements
- Focus: Kubernetes manifests, service mesh integration, monitoring, logging
- Tools: kubectl for cluster analysis, infrastructure pattern detection
- Output: Deployment architecture and operational requirements
ELSE:
EXECUTE streamlined single-service containerization analysis:
# Single-service analysis workflow
echo "🔍 Analyzing single-service containerization requirements..."
STEP 3: Intelligent Dockerfile generation based on detected technology stack
CASE detected_technology: WHEN "rust":
**Rust Projects (Axum/Warp optimized):**
# Build stage
FROM rust:1.80-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache musl-dev pkgconfig openssl-dev
# Cache dependencies
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release && rm -rf src/
# Build application
COPY src/ src/
RUN touch src/main.rs && cargo build --release
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
RUN addgroup -g 1001 -S appgroup && adduser -u 1001 -S appuser -G appgroup
WORKDIR /app
COPY --from=builder /app/target/release/app /app/
RUN chown -R appuser:appgroup /app
USER appuser
EXPOSE 8080
CMD ["./app"]**Go Projects:**
# Build stage
FROM golang:1.22-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git ca-certificates tzdata
# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download && go mod verify
# Build application
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app ./cmd/server
# Runtime stage
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /app/app /app
EXPOSE 8080
CMD ["/app"]
**Java Projects (Spring Boot/Quarkus):**
# Build stage
FROM eclipse-temurin:21-jdk-alpine AS builder
WORKDIR /app
# Cache dependencies
COPY pom.xml ./
COPY mvnw ./
COPY .mvn .mvn
RUN ./mvnw dependency:go-offline -B
# Build application
COPY src src
RUN ./mvnw clean package -DskipTests -B
# Runtime stage
FROM eclipse-temurin:21-jre-alpine
RUN addgroup -g 1001 -S appgroup && adduser -u 1001 -S appuser -G appgroup
WORKDIR /app
COPY --from=builder /app/target/*.jar app.jar
RUN chown appuser:appgroup app.jar
USER appuser
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
**Deno Projects:**
# Build stage (if compilation needed)
FROM denoland/deno:1.46.0 AS b
Read more
allowed-tools: Task, Read, Write, Edit, MultiEdit, Bash(fd:*), Bash(rg:*), Bash(eza:*), Bash(bat:*), Bash(jq:*), Bash(gdate:*), Bash(docker:*), Bash(kubectl:*), Bash(mvn:*), Bash(gradle:*), Bash(cargo:*), Bash(go:*) name: "Containerize" description: "Production-ready containerization orchestrator with multi-stage builds, security hardening, and Kubernetes optimization" author: "wcygan" tags: ["ops","deploy"] version: "1.0.0" created_at: "2025-07-14T00:00:00Z" updated_at: "2025-07-14T00:00:00Z"
Context
- Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
- Target project: $ARGUMENTS
- Current directory: !`pwd`
- Project structure: !`eza -la --tree --level=2 2>/dev/null | head -15 || fd . -t d -d 2 | head -10`
- Build files detected: !`fd "(Dockerfile|docker-compose|package\.json|Cargo\.toml|go\.mod|pom\.xml|build\.gradle|deno\.json)" . -d 3 | head -10 || echo "No build files detected"`
- Container tools status: !`echo "docker: $(which docker >/dev/null && echo ✓ || echo ✗) | kubectl: $(which kubectl >/dev/null && echo ✓ || echo ✗) | hadolint: $(which hadolint >/dev/null && echo ✓ || echo ✗)"`
- Existing containers: !`docker ps -a --format "table {{.Names}}\t{{.Image}}\t{{.Status}}" 2>/dev/null | head -5 || echo "No Docker daemon or containers found"`
Your Task
STEP 1: Initialize containerization session and analyze project architecture
- CREATE session state file: `/tmp/containerize-session-$SESSION_ID.json`
- ANALYZE project structure and technology stack from Context section
- DETECT primary and secondary languages/frameworks
- IDENTIFY existing containerization (Dockerfile, docker-compose.yml, K8s manifests)
# Initialize containerization session state
echo '{
"sessionId": "'$SESSION_ID'",
"targetProject": "'$ARGUMENTS'",
"detectedTechnologies": [],
"containerStrategy": "auto-detect",
"securityProfile": "production",
"deploymentTarget": "kubernetes"
}' > /tmp/containerize-session-$SESSION_ID.jsonSTEP 2: Comprehensive project analysis with parallel sub-agent coordination
TRY:
IF project_complexity == "multi-service" OR technology_stack == "polyglot":
LAUNCH parallel sub-agents for comprehensive project analysis:
- **Agent 1: Technology Stack Analysis**: Analyze all build files, dependencies, and frameworks
- Focus: Package managers, runtime requirements, build tools, version constraints
- Tools: fd for file discovery, rg for dependency searches, language-specific tools
- Output: Technology manifest with build requirements and constraints
- **Agent 2: Security & Compliance Assessment**: Evaluate security requirements and compliance needs
- Focus: Secrets management, network policies, security contexts, vulnerability scanning
- Tools: rg for credential patterns, static analysis of existing configurations
- Output: Security profile and hardening recommendations
- **Agent 3: Performance & Optimization**: Analyze performance requirements and optimization opportunities
- Focus: Build caching, layer optimization, resource requirements, scaling patterns
- Tools: Analysis of build artifacts, dependency graphs, performance bottlenecks
- Output: Optimization strategy and resource allocation recommendations
- **Agent 4: Deployment Architecture**: Design deployment strategy and infrastructure requirements
- Focus: Kubernetes manifests, service mesh integration, monitoring, logging
- Tools: kubectl for cluster analysis, infrastructure pattern detection
- Output: Deployment architecture and operational requirements
ELSE:
EXECUTE streamlined single-service containerization analysis:
# Single-service analysis workflow echo "🔍 Analyzing single-service containerization requirements..."
STEP 3: Intelligent Dockerfile generation based on detected technology stack
CASE detected_technology: WHEN "rust":
**Rust Projects (Axum/Warp optimized):**
# Build stage
FROM rust:1.80-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache musl-dev pkgconfig openssl-dev
# Cache dependencies
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release && rm -rf src/
# Build application
COPY src/ src/
RUN touch src/main.rs && cargo build --release
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
RUN addgroup -g 1001 -S appgroup && adduser -u 1001 -S appuser -G appgroup
WORKDIR /app
COPY --from=builder /app/target/release/app /app/
RUN chown -R appuser:appgroup /app
USER appuser
EXPOSE 8080
CMD ["./app"]**Go Projects:**
# Build stage FROM golang:1.22-alpine AS builder WORKDIR /app # Install build dependencies RUN apk add --no-cache git ca-certificates tzdata # Cache dependencies COPY go.mod go.sum ./ RUN go mod download && go mod verify # Build application COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app ./cmd/server # Runtime stage FROM scratch COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo COPY --from=builder /app/app /app EXPOSE 8080 CMD ["/app"]
**Java Projects (Spring Boot/Quarkus):**
# Build stage FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /app # Cache dependencies COPY pom.xml ./ COPY mvnw ./ COPY .mvn .mvn RUN ./mvnw dependency:go-offline -B # Build application COPY src src RUN ./mvnw clean package -DskipTests -B # Runtime stage FROM eclipse-temurin:21-jre-alpine RUN addgroup -g 1001 -S appgroup && adduser -u 1001 -S appuser -G appgroup WORKDIR /app COPY --from=builder /app/target/*.jar app.jar RUN chown appuser:appgroup app.jar USER appuser EXPOSE 8080 ENTRYPOINT ["java", "-jar", "app.jar"]
**Deno Projects:**
# Build stage (if compilation needed) FROM denoland/deno:1.46.0 AS b
A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.
Repo: kiliczsh/claude-cmd
Other commands on claude-cmd.
- /agent-browser-automation
Automate browser interactions for development testing using Puppeteer MCP
Open command - /agent-prep-merge
Prepare branches for merging across multiple worktrees and coordinate integration
Open command - /agent-persona-accessibility-expert
Transform into accessibility expert for WCAG compliance and inclusive design
Open command - /agent-persona-api-designer
Transform into an API design specialist who creates well-structured, developer-friendly APIs
Open command - /agent-persona-backend-specialist
Transform into backend specialist for scalable API and system design
Open command - /agent-persona-cloud-architect
Cloud architect persona for designing scalable, secure cloud infrastructure using modern cloud-native technologies
Open command

