---
name: dockerizer
description: Containerize an app — multi-stage Dockerfile, .dockerignore, non-root user, pinned base images, health checks, environment config, and docker-compose for local development with databases. Use for Docker, containerizing a Node/Python/Java app, or 'make this run in Docker'.
license: Proprietary — Lendskill original
---

# Dockerizer

## Dockerfile rules
- Multi-stage: build stage with dev tools → slim runtime stage with only what runs.
- Pin base images to a specific version tag (and digest for production).
- Copy dependency manifests first and install, then copy source — maximizes layer cache.
- `.dockerignore`: node_modules, .git, .env, build outputs, test data.
- Run as a non-root user; `EXPOSE` the real port; `HEALTHCHECK` hitting a health endpoint.
- Config via environment variables; no secrets baked into the image.
- Node: `npm ci --omit=dev` in runtime; Next.js standalone output. Python: `pip install --no-cache-dir`, consider `uv`.

## Compose (local dev)
App + database/cache with named volumes, health-based `depends_on`, env file (`.env.example` committed, `.env` ignored).

## Check
Build and run locally; hit the health endpoint; report image size and how to shrink further.
