agentleFS
HM-IT-CODEHM-IT-CODE/forge-skills/skills/devops/dockerize/SKILL.md

dockerize

Skill0 starsChanged 6 months agoMITView on GitHub

Generates a production-grade, multi-stage Dockerfile and docker-compose for a project. Use when the user says "dockerize", "containerize this", "write a Dockerfile", "add Docker", or wants to package a service for deployment. Detects the stack and applies small-image, non-root, layer-caching best practices.

  • Reads credentials
  • Deletes or force-pushes

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. Pradnyeshp/Claude-Skills★ 2same name
    2. walterlow/claude-skills★ 2same 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 repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always use multi-stage builds: a builder stage with the toolchain, and a minimal runtime stage that copies only the artifact.

    line 23
  2. Distinctive:

    Run as non-root: create and switch to an unprivileged user.

    line 30
  3. Distinctive:

    No secrets in layers: Use build args / runtime env, never bake credentials.

    line 31
  4. Very specific:

    Add a HEALTHCHECK when the service exposes a port.

    line 32
  5. Very specific:

    If the service needs a database or other dependency, generate a docker-compose.yml wiring the app to its dependencies with named volumes, a …

    line 71

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dockerize

Produce a Dockerfile a platform team would approve: small, secure, reproducible, and fast to rebuild. Never a single fat FROM language with the whole repo copied in.

Step 1 — Detect the stack

Inspect the repo to determine language, build tool, and run command:

  • Node/TS: package.json (scripts, engines), lockfile (pnpm-lock.yaml / package-lock.json / yarn.lock).
  • Python: pyproject.toml / requirements.txt, entry module.
  • Rust: Cargo.toml, binary name from [[bin]] or package name.
  • Go: go.mod, main package path.

Confirm the detected build and start commands. If ambiguous, ask.

Step 2 — Write a multi-stage Dockerfile

Always use multi-stage builds: a builder stage with the toolchain, and a minimal runtime stage that copies only the artifact.

Apply these rules in every Dockerfile:

  • Pin the base image to a specific minor + variant (e.g. node:22-slim, python:3.12-slim, rust:1.79, golang:1.22). Avoid latest.
  • Order layers for cache: copy dependency manifests and install deps before copying source, so code changes don't bust the dependency layer.
  • Minimal runtime base: distroless, alpine, -slim, or scratch (Go/Rust static binaries).
  • Run as non-root: create and switch to an unprivileged user.
  • No secrets in layers. Use build args / runtime env, never bake credentials.
  • Add a HEALTHCHECK when the service exposes a port.
  • Set EXPOSE, a sensible WORKDIR, and an explicit CMD (exec form, JSON array).

Reference shape (Rust static binary)

# ---- builder ----
FROM rust:1.79-slim AS builder
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release && rm -rf src
COPY . .
RUN cargo build --release

# ---- runtime ----
FROM gcr.io/distroless/cc-debian12
COPY --from=builder /app/target/release/<binary> /usr/local/bin/app
USER nonroot:nonroot
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/app"]

Adapt the same two-stage pattern to whatever stack you detected.

Step 3 — Add .dockerignore

Generate a .dockerignore that excludes build artifacts and local junk so the build context stays small:

.git
target/
node_modules/
dist/
**/*.log
.env*

Step 4 — docker-compose (if it helps)

If the service needs a database or other dependency, generate a docker-compose.yml wiring the app to its dependencies with named volumes, a healthcheck-gated depends_on, and env passed via environment / .env. Keep it self-hostable with one docker compose up.

Step 5 — Verify

Show the user the docker build command and, where possible, note the expected final image size order of magnitude. Point out anything stack-specific they should tune (e.g. multi-arch builds, build secrets). Do not run pushes to any registry.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.