mcpField
A
adding-docker

adding-docker

github.com/spencerpaulyCloud & DevOps868403 installsUpdated 13w ago
Repository

About adding-docker

A skill that guides adding Docker support to an application. It covers runtime detection, a multi-stage Dockerfile, ignore rules, optional Compose configuration and scripts, with attention to environment files and deployment health checks.

Key features

  1. 01Detect the application runtime
  2. 02Create a multi-stage Dockerfile
  3. 03Configure .dockerignore
  4. 04Add Compose configuration for dependencies
  5. 05Optionally add npm scripts

Use cases

  1. 01Add Docker support to an application
  2. 02Containerize an app with database or Redis dependencies
  3. 03Prepare a Docker build while keeping environment files out of the image

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/spencerpauly/awesome-cursor-skills --skill adding-docker

After installing, type/adding-dockerin Claude Code to confirm it loaded.

Details

From the project README

Add Docker

Use this skill when the user asks to dockerize, containerize, or add Docker support to an application.

Steps

  1. Detect the runtime — inspect package.json, requirements.txt, go.mod, Cargo.toml, etc. to determine the language and runtime.

  2. Create a multi-stage Dockerfile

    For Node.js (example):

    FROM node:20-alpine AS base
    
    FROM base AS deps
    WORKDIR /app
    COPY package.json package-lock.json ./
    RUN npm ci --omit=dev
    
    FROM base AS build
    WORKDIR /app
    COPY package.json package-lock.json ./
    RUN npm ci
    COPY . .
    RUN npm run build
    
    FROM base AS runner
    WORKDIR /app
    ENV NODE_ENV=production
    COPY --from=deps /app/node_modules ./node_modules
    COPY --from=build /app/.next ./.next
    COPY --from=build /app/public ./public
    COPY --from=build /app/package.json ./
    EXPOSE 3000
    CMD ["npm", "start"]
    

    Adapt for the detected framework — adjust the build output directory, entry command, and base image.

  3. Create .dockerignore

    node_modules
    .next
    .git
    .env*
    *.md
    
  4. Create docker-compose.yml (if the app has dependencies like a database or Redis):

    services:
      app:
        build: .
        ports:
          - "3000:3000"
        env_file: .env
        depends_on:
          - db
      db:
        image: postgres:16-alpine
        environment:
          POSTGRES_DB: app
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        volumes:
          - pgdata:/var/lib/postgresql/data
    volumes:
      pgdata:
    
  5. Add npm scripts (optional)

    {
      "docker:build": "docker build -t myapp .",
      "docker:run": "docker compose up"
    }
    

Notes

  • Use Alpine-based images to minimize image size.
  • Never copy .env files into the image — use env_file or runtime injection.
  • For monorepos, use a .dockerignore that excludes sibling packages not needed by the target app.
  • Add a HEALTHCHECK instruction for production deployments.

Comments

Markdown supported