dockerfile-slim

von AgentsRoomVon AgentsRoom verifiziertNoch keine InstallationNoch keine LikesAktualisiert am 7. Mai 2026Kategorie: Engineering

Was er macht

Use when writing a Dockerfile. Multi-stage build, slim base image, non-root user, sensible CMD/ENTRYPOINT split.

Die Installation öffnet diesen Eintrag in deiner AgentsRoom-Desktop-App. Ist die App noch nicht installiert, landest du auf der Download-Seite.

SKILL.md

---
name: dockerfile-slim
description: Use when writing a Dockerfile. Multi-stage build, slim base image, non-root user, sensible CMD/ENTRYPOINT split.
---

# Dockerfile slim

When writing a Dockerfile:

1. Multi-stage: `builder` (full image) → `runner` (slim/distroless).
2. Pin the base image (`node:20.11-slim`, not `node:slim`).
3. Run as non-root: `USER node` (or create a `app` user).
4. Don't copy `node_modules` from host. Copy `package*.json` first, install, then copy source — leverage layer cache.
5. `HEALTHCHECK` if the service is long-lived; sensible `EXPOSE`.

Tags

devopsdocker