Skip to content
Agentmart
Submit a tool

dockerfile-hygiene

Dockerfiles that build fast, stay small and do not run as root — layer ordering, multi-stage builds and the cache rules behind them.

Skill by UnicoLab

IndexedMIT★ 1
Write a review

Chalk Labs

Need help deploying dockerfile-hygiene?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/unicolab-dockerfile-hygiene

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Dockerfiles that build fast, stay small and do not run as root — layer ordering, multi-stage builds and the cache rules behind them.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Nov 1, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/dockerfile-hygiene

What's inside

Skill name
dockerfile-hygiene
Description
Dockerfiles that build fast, stay small and do not run as root — layer ordering, multi-stage builds and the cache rules behind them.
License
MIT
Instructions
50 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Dockerfile hygiene

```dockerfile
# syntax=docker/dockerfile:1
FROM golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./          # deps first: this layer caches across code edits
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /out/app ./cmd/app

FROM gcr.io/distroless/static-debian12
COPY --from=build /out/app /app
USER nonroot:nonroot
ENTRYPOINT ["/app"]
```

## Layer order is the build time

Copy the dependency manifest and install dependencies **before** copying the
source. `COPY . .` first invalidates every later layer on any code change, so
every build reinstalls everything.

## The rules

- **Multi-stage.** The final image should contain the artifact and its runtime,
  not the compiler, the package index, or the test fixtures.
- **Pin the base image** to a version (`python:3.12-slim`, not `python:latest`).
  `latest` makes a build reproducible only by accident.
- **`USER` a non-root account** before `ENTRYPOINT`. Root in a container is root
  on the host in more configurations than people expect.
- **`ENTRYPOINT` in exec form** (`["/app"]`). Shell form wraps the process in
  `/bin/sh -c`, which swallows `SIGTERM` — the container then takes the full
  kill timeout to stop on every deploy.
- **A `.dockerignore`** with at least `.git`, `node_modules`, build output and
  local env files. Without one the whole working tree is sent to the daemon and
  secrets land in layers.
- **Never `COPY` a secret**, even if a later layer deletes it — every layer is
  in the image. Use build secrets (`RUN --mount=type=secret`) or runtime env.
- **Combine `apt-get update` with the install** in one `RUN` and clean the lists
  in the same layer, or the cached index goes stale and the cleanup does nothing.
- **`HEALTHCHECK`** when an orchestrator will use it; leave it out when it won't.

## Verify

`docker build .` succeeding is not enough — check the final size
(`docker images`) and that the process runs as the expected user
(`docker run --rm <img> id`, when the image has a shell).

From UnicoLab/smlcode, MIT.

More from UnicoLab/smlcode

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Aug 23, 2026 (2 months ago)
Last release
Oct 20, 2026 (13 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from UnicoLab

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get dockerfile-hygiene running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying dockerfile-hygiene?

CallGet help
Cite this page

dockerfile-hygiene skill. Agent Mart. https://agentmart.dev/skills/unicolab-dockerfile-hygiene (last updated 2026-10-24)