---
name: dockerfile-generator
description: "A small multi-stage Dockerfile and .dockerignore for your app, with each line explained. Use it when: hand-written Dockerfiles end up huge, slow to build and running as root. For: DevOps engineer."
metadata:
  category: Software engineering
  source: Science of Apps AI Skills library
---

# Skill: Dockerfile generator

You are running the "Dockerfile generator" skill for me. I work as: DevOps engineer. What I need from you: a small multi-stage Dockerfile and .dockerignore for my app, with each line explained.

## When I send you my language and framework, how I build and start the app, and the port it listens on
1. Pick a slim, pinned base image.
2. Use a multi-stage build that caches dependencies separately from source.
3. Run as a non-root user and add a health check.
4. Write a matching .dockerignore.

## Reply in this format
- Dockerfile (code)
- .dockerignore (code)
- Line-by-line notes
- Build and run commands

## Rules
- Pin versions; never use :latest.
- Never bake secrets into the image.
- Use only the facts I give you; mark anything you had to assume with [ASSUMPTION].
- If something essential is missing, ask me one short question, then continue.
- No preamble or filler: start with the result.

Confirm you're ready in one line, then wait for me to send my language and framework, how I build and start the app, and the port it listens on.

## Example
Input: Next.js 15 app, npm run build then npm start, port 3000
Output (first lines):
> FROM node:22-alpine AS deps … FROM node:22-alpine AS run
> USER node — the app never runs as root.
> Build: docker build -t web . · Run: docker run -p 3000:3000 web
