$npx -y skills add DNYoussef/context-cascade --skill docker-containerization/*============================================================================*/ /* DOCKER-CONTAINERIZATION SKILL :: VERILINGUA x VERIX EDITION */ /*============================================================================*/
| 1 | /*============================================================================*/ |
| 2 | /* DOCKER-CONTAINERIZATION SKILL :: VERILINGUA x VERIX EDITION */ |
| 3 | /*============================================================================*/ |
| 4 | |
| 5 | --- |
| 6 | name: docker-containerization |
| 7 | version: 1.0.0 |
| 8 | description: | |
| 9 | [assert|neutral] Docker containerization specialist for multi-stage builds, layer caching optimization, security scanning with Trivy, Docker Compose orchestration, BuildKit advanced features, and production-grade Dock [ground:given] [conf:0.95] [state:confirmed] |
| 10 | category: Infrastructure |
| 11 | tags: |
| 12 | - general |
| 13 | author: system |
| 14 | cognitive_frame: |
| 15 | primary: aspectual |
| 16 | goal_analysis: |
| 17 | first_order: "Execute docker-containerization workflow" |
| 18 | second_order: "Ensure quality and consistency" |
| 19 | third_order: "Enable systematic Infrastructure processes" |
| 20 | --- |
| 21 | |
| 22 | /*----------------------------------------------------------------------------*/ |
| 23 | /* S0 META-IDENTITY */ |
| 24 | /*----------------------------------------------------------------------------*/ |
| 25 | |
| 26 | [define|neutral] SKILL := { |
| 27 | name: "docker-containerization", |
| 28 | category: "Infrastructure", |
| 29 | version: "1.0.0", |
| 30 | layer: L1 |
| 31 | } [ground:given] [conf:1.0] [state:confirmed] |
| 32 | |
| 33 | /*----------------------------------------------------------------------------*/ |
| 34 | /* S1 COGNITIVE FRAME */ |
| 35 | /*----------------------------------------------------------------------------*/ |
| 36 | |
| 37 | [define|neutral] COGNITIVE_FRAME := { |
| 38 | frame: "Aspectual", |
| 39 | source: "Russian", |
| 40 | force: "Complete or ongoing?" |
| 41 | } [ground:cognitive-science] [conf:0.92] [state:confirmed] |
| 42 | |
| 43 | ## Kanitsal Cerceve (Evidential Frame Activation) |
| 44 | Kaynak dogrulama modu etkin. |
| 45 | |
| 46 | /*----------------------------------------------------------------------------*/ |
| 47 | /* S2 TRIGGER CONDITIONS */ |
| 48 | /*----------------------------------------------------------------------------*/ |
| 49 | |
| 50 | [define|neutral] TRIGGER_POSITIVE := { |
| 51 | keywords: ["docker-containerization", "Infrastructure", "workflow"], |
| 52 | context: "user needs docker-containerization capability" |
| 53 | } [ground:given] [conf:1.0] [state:confirmed] |
| 54 | |
| 55 | /*----------------------------------------------------------------------------*/ |
| 56 | /* S3 CORE CONTENT */ |
| 57 | /*----------------------------------------------------------------------------*/ |
| 58 | |
| 59 | # Docker Containerization Specialist |
| 60 | |
| 61 | ## Kanitsal Cerceve (Evidential Frame Activation) |
| 62 | Kaynak dogrulama modu etkin. |
| 63 | |
| 64 | |
| 65 | |
| 66 | Expert Docker containerization for production-grade, secure, and optimized container images. |
| 67 | |
| 68 | ## Purpose |
| 69 | |
| 70 | Comprehensive Docker expertise including multi-stage builds, layer caching, security scanning, Docker Compose, BuildKit features, and best practices. Ensures containers are small, fast, secure, and production-ready. |
| 71 | |
| 72 | ## When to Use |
| 73 | |
| 74 | - Creating optimized Dockerfiles |
| 75 | - Implementing multi-stage builds |
| 76 | - Optimizing build caching |
| 77 | - Scanning images for vulnerabilities |
| 78 | - Orchestrating multi-container apps with Docker Compose |
| 79 | - Implementing CI/CD with Docker |
| 80 | - Troubleshooting container performance |
| 81 | |
| 82 | ## Prerequisites |
| 83 | |
| 84 | **Required**: Basic Docker commands, understanding of containers vs VMs |
| 85 | |
| 86 | **Agents**: `cicd-engineer`, `security-manager`, `code-analyzer`, `backend-dev` |
| 87 | |
| 88 | ## Core Workflows |
| 89 | |
| 90 | ### Workflow 1: Multi-Stage Node.js Build |
| 91 | |
| 92 | ```dockerfile |
| 93 | # syntax=docker/dockerfile:1 |
| 94 | # Stage 1: Dependencies |
| 95 | FROM node:18-alpine AS deps |
| 96 | WORKDIR /app |
| 97 | COPY package*.json ./ |
| 98 | RUN npm ci --only=production && npm cache clean --force |
| 99 | |
| 100 | # Stage 2: Build |
| 101 | FROM node:18-alpine AS builder |
| 102 | WORKDIR /app |
| 103 | COPY package*.json ./ |
| 104 | RUN npm ci |
| 105 | COPY . . |
| 106 | RUN npm run build |
| 107 | |
| 108 | # Stage 3: Production |
| 109 | FROM node:18-alpine AS runner |
| 110 | WORKDIR /app |
| 111 | |
| 112 | # Security: Run as non-root |
| 113 | RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001 |
| 114 | |
| 115 | # Copy only necessary files |
| 116 | COPY --from=deps --chown=nodejs:nodejs /app/node_modules ./node_modules |
| 117 | COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist |
| 118 | COPY --chown=nodejs:nodejs package.json ./ |
| 119 | |
| 120 | USER nodejs |
| 121 | EXPOSE 3000 |
| 122 | ENV NODE_ENV=production |
| 123 | |
| 124 | HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ |
| 125 | CMD node -e "require('http').get('http://localhost:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); })" |
| 126 | |
| 127 | CMD ["node", "dist/index.js"] |
| 128 | ``` |
| 129 | |
| 130 | ### Workflow 2: Python Multi-Stage Build |
| 131 | |
| 132 | ```dockerfile |
| 133 | # syntax=docker/dockerfile:1 |
| 134 | FROM python:3.11-slim AS builder |
| 135 | |
| 136 | WORKDIR /app |
| 137 | |
| 138 | # Install build dependencies |
| 139 | RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 140 | gcc \ |
| 141 | && rm -rf /var/lib/apt/lists/* |
| 142 | |
| 143 | # Install Python dependencies |
| 144 | COPY requirements.txt . |
| 145 | RUN pip install --user --no-cache-dir -r requirements.txt |
| 146 | |
| 147 | # Production stage |
| 148 | FROM python:3.11-slim |
| 149 | |
| 150 | WORKDIR /app |
| 151 | |
| 152 | # Copy Python dependencies from builder |
| 153 | COPY --from=builder /root/.local /root/.local |
| 154 | |
| 155 | # Copy application code |
| 156 | COPY . . |
| 157 | |
| 158 | # Security: Run as non-root |
| 159 | RUN userad |