dockerfile
Skill0 starsChanged 8 months agoMITView on GitHub
Generate a production-grade Dockerfile for the current project. Use this when the user asks to create a Dockerfile, dockerize or containerize a project, or when a project has no Dockerfile and the user wants to deploy it. Works for Node, Python, Go, Rust, Java, Ruby, PHP, and more.
- Reads credentials
- Installs packages
6 other projects use a version of this.
Adopted by
Most recently taken up by
- AnthonyPoschen/agent-skillstheir own version, first seen Aug 25, 2026
- petr-korobeinikov/skillstheir own version, first seen Jun 28, 2026
- Cogni-AI-OU/cogni-ai-agent-skillstheir own version, first seen May 19, 2026
- brpaz/agent-skillstheir own version, first seen May 17, 2026
- zeon-kun/claude-skillstheir own version, first seen Apr 7, 2026
- CorentinGC/claude-skillstheir own version, first seen Mar 7, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- zeon-kun/claude-skills★ 6same name
- Cogni-AI-OU/cogni-ai-agent-skills★ 4same name
- AnthonyPoschen/agent-skills★ 2same name
- brpaz/agent-skills★ 1same name
- petr-korobeinikov/skills★ 1same name
- CorentinGC/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- composeSkill
- docker-debugSkill
- helm-reviewSkill
- k8s-debugSkill
- manifestSkill
- rbac-reviewSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 6 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Create a Dockerfile for the current project that follows container best practices: multi-stage builds, pinned base images, non-root users, …
- Very specific: line 18
If $ARGUMENTS is empty, detect the language and framework by reading the project files.
- Distinctive: line 22
Use Glob to look for these files at the project root:
- Distinctive: line 30
If multiple are present, ask the user which target to use.
- Distinctive: line 31
If none are found, ask the user to specify the language and framework.
- Very specific: line 36
Pinned base images: never use latest. Use a specific version and a minimal variant (alpine, slim, or distroless) where possible.
- Very specific: line 39
EXPOSE and ports: add an EXPOSE instruction that matches the application's listen port.
- Very specific: line 40
Signal handling: use the exec form of CMD (JSON array syntax).
- Very specific: line 41
Minimal copy: avoid copying secrets, .git, node_modules, virtualenvs, or local build artifacts.
- Very specific: line 42
Health check: add a HEALTHCHECK when the app exposes a readiness or health endpoint.
- Very specific: line 46
Write a file named Dockerfile at the project root.
- Very specific: line 47
If there is no .dockerignore, also write one with sensible defaults.
- Very specific: line 136
Do not use latest tags for base images.
- Distinctive: line 137
Do not run the runtime stage as root.
- Very specific: line 138
Do not copy .env files or secrets into the image.
- Distinctive: line 139
Do not leave build tools in the runtime stage.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Generate a production-grade Dockerfile
Create a Dockerfile for the current project that follows container best practices: multi-stage builds, pinned base images, non-root users, layer caching, and security hardening.
Inputs
$ARGUMENTS is an optional hint about the language or framework.
Examples: node, python fastapi, go, rails, next.js.
If $ARGUMENTS is empty, detect the language and framework by reading the project files.
Detection steps (run only when no argument is given)
- Use Glob to look for these files at the project root:
package.jsonmeans Node.js. Read it to find the framework (Next.js, Express, NestJS, Nuxt).requirements.txt,pyproject.toml, orPipfilemeans Python. Read to find the framework (Django, Flask, FastAPI).go.modmeans Go.Cargo.tomlmeans Rust.pom.xmlorbuild.gradlemeans Java (Maven or Gradle).Gemfilemeans Ruby, typically Rails.composer.jsonmeans PHP, typically Laravel or Symfony.
- If multiple are present, ask the user which target to use.
- If none are found, ask the user to specify the language and framework.
Required Dockerfile characteristics
- Multi-stage build: separate the builder stage from the runtime stage. The runtime image should not contain build tools.
- Pinned base images: never use
latest. Use a specific version and a minimal variant (alpine, slim, or distroless) where possible. - Non-root user: the runtime stage must run as a non-root user.
- Layer caching: copy dependency manifests first, install dependencies, then copy the rest of the source. Source changes must not invalidate dependency layers.
- EXPOSE and ports: add an
EXPOSEinstruction that matches the application's listen port. - Signal handling: use the
execform ofCMD(JSON array syntax). Considertinifor runtimes that do not reap zombies cleanly. - Minimal copy: avoid copying secrets,
.git,node_modules, virtualenvs, or local build artifacts. Use a.dockerignorefile. - Health check: add a
HEALTHCHECKwhen the app exposes a readiness or health endpoint.
Output steps
- Write a file named
Dockerfileat the project root. - If there is no
.dockerignore, also write one with sensible defaults. - Briefly explain (3 to 5 short bullets) the stages and any non-obvious choices.
- Show the exact commands to build and run locally. Pick the host and container ports that match the app:
docker build -t my-app .
docker run --rm -p 3000:3000 my-appExample output for Node.js / Next.js
# syntax=docker/dockerfile:1.7
FROM node:20.12-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
FROM node:20.12-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:20.12-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
RUN addgroup -S app && adduser -S app -G app
COPY --from=builder --chown=app:app /app/.next/standalone ./
COPY --from=builder --chown=app:app /app/.next/static ./.next/static
COPY --from=builder --chown=app:app /app/public ./public
USER app
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/api/health || exit 1
CMD ["node", "server.js"]Example output for Python / FastAPI
# syntax=docker/dockerfile:1.7
FROM python:3.12-slim AS builder
WORKDIR /app
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
FROM python:3.12-slim AS runtime
WORKDIR /app
ENV PATH="/opt/venv/bin:$PATH" PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
RUN useradd -r -s /bin/false app
COPY --from=builder /opt/venv /opt/venv
COPY --chown=app:app . .
USER app
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=3s CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]Example .dockerignore
.git
.gitignore
node_modules
.next
.venv
__pycache__
.env
.env.*
.DS_Store
npm-debug.log
.vscode
.idea
coverage
.nyc_output
dist
build
Dockerfile
.dockerignore
README.mdDo not
- Do not use
latesttags for base images. - Do not run the runtime stage as root.
- Do not copy
.envfiles or secrets into the image. - Do not leave build tools in the runtime stage.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

