Skip to content
dockerfile-helper logo

Dockerfile Helper

dockerfile-helper

Dockerfile の作成・改善を支援する。「Dockerfile を作って」「Dockerfile 作成」「Dockerfile をレビュー」「Dockerfile 改善」「Dockerfile 最適化」「マルチステージビルド」「alpine 化」「イメージサイズ削減」「Dockerfile のベストプラクティス」などで起動。

SKILL.md

Full skill instructions

Dockerfile Helper

Dockerfile の作成・改善を支援します。

対応操作

操作トリガー例
新規作成「Dockerfile を作って」「Dockerfile 作成」
レビュー「Dockerfile をレビュー」「Dockerfile 改善」
最適化「マルチステージビルド」「alpine 化」「サイズ削減」

実行手順

1. 意図の判定

  • 新規作成: 「作って」「作成」「生成」→ 新しい Dockerfile を作成
  • レビュー/改善: 「レビュー」「改善」「チェック」→ /​shiiman-docker:lint に委譲
  • 最適化: 「最適化」「alpine」「マルチステージ」「サイズ削減」→ 既存 Dockerfile を最適化

2. 新規作成の場合

プロジェクトの言語/フレームワーク特定
ls package.json go.mod requirements.txt Gemfile pom.xml build.gradle Cargo.toml 2>/​dev/​null
言語別テンプレート生成

Node.js (package.json 検出時):

# Build stage
FROM node:20-alpine AS builder
WORKDIR /​app
COPY package*.json ./
RUN npm ci

# Production stage
FROM node:20-alpine
RUN addgroup -S app && adduser -S app -G app
WORKDIR /​app
COPY --from=builder /​app/​node_modules ./​node_modules
COPY . .
USER app
EXPOSE 3000
CMD ["node", "index.js"]

Go (go.mod 検出時):

# Build stage
FROM golang:1.22-alpine AS builder
WORKDIR /​app
COPY go.* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o main .

# Production stage
FROM scratch
COPY --from=builder /​app/​main /​main
ENTRYPOINT ["/​main"]

Python (requirements.txt 検出時):

# Build stage
FROM python:3.12-slim AS builder
WORKDIR /​app
COPY requirements.txt .
RUN pip install --no-cache-dir --target=/​app/​deps -r requirements.txt

# Production stage
FROM python:3.12-slim
RUN useradd -m -r app
WORKDIR /​app
ENV PYTHONPATH=/​app/​deps
COPY --from=builder /​app/​deps /​app/​deps
COPY . .
USER app
CMD ["python", "main.py"]
.dockerignore も同時に作成
.git
.gitignore
README.md
Dockerfile*
docker-compose*
.env*
*.log
node_modules
__pycache__
*.pyc
.pytest_cache
coverage
.coverage
dist
build
*.egg-info

3. レビュー/改善の場合

/​shiiman-docker:lint コマンドに委譲(SSOT):

レビューを実行するには `/​shiiman-docker:lint` を使用します。

4. 最適化の場合

既存の Dockerfile を読み込み、以下の観点で最適化:

マルチステージビルド化

単一ステージの Dockerfile をマルチステージに変換:

# Before
FROM node:20
WORKDIR /​app
COPY . .
RUN npm install
CMD ["npm", "start"]

# After
FROM node:20-alpine AS builder
WORKDIR /​app
COPY package*.json ./
RUN npm ci --only=production

FROM node:20-alpine
WORKDIR /​app
COPY --from=builder /​app/​node_modules ./​node_modules
COPY . .
CMD ["npm", "start"]
alpine 化

フルイメージを alpine に変更:

BeforeAfterサイズ削減
node:20node:20-alpine~900MB → ~180MB
python:3.12python:3.12-slim~1GB → ~150MB
golang:1.22golang:1.22-alpine~800MB → ~250MB
レイヤー最適化
# Before
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y git
RUN rm -rf /​var/​lib/​apt/​lists/​*

# After
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        curl \
        git && \
    rm -rf /​var/​lib/​apt/​lists/​*

5. 出力フォーマット

## Dockerfile 作成完了

**ファイル**: Dockerfile
**ベースイメージ**: {base_image}
**ステージ数**: {stages}
**推定サイズ**: {estimated_size}

### 特徴

- ✅ マルチステージビルド
- ✅ 非 root ユーザー
- ✅ alpine ベースイメージ
- ✅ .dockerignore 同梱

### 次のステップ

1. `docker build -t myapp .` でビルド
2. `docker run -p 3000:3000 myapp` で実行

注意事項

  • ✅ マルチステージビルドを推奨
  • ✅ alpine/​slim イメージを推奨
  • ✅ 非 root ユーザーでの実行を推奨
  • ✅ .dockerignore を同時に作成
  • ✅ レビューは /​shiiman-docker:lint に委譲(SSOT)
  • ❌ 機密情報をハードコードしない

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View