AI Compare Ninja AI Compare Ninja

Compare AI tools. Use prompts and skills.

Language
EN

Review a Dockerfile for size, security and build time

Prompt that reviews a Dockerfile for image size, build cache, root privileges and secrets and returns an improved version with reasons. Paste it into an AI tool of your choice, which then reviews the Dockerfile.

Topic
Apps & prototypes
Type
Prompt
Level
Intermediate
Time
about 8 min

Results depend on the tool, the model and what you enter.

Result preview

Example: written by our editors, not real AI output.

Before 1.2 GB · after about 180 MB FROM node:22-slim AS build WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build FROM node:22-slim WORKDIR /app COPY --from=build /app/dist ./dist COPY --from=build /app/node_modules ./node_modules USER node CMD ["node", "dist/server.js"] Change · Reason · Effect pinned version instead of latest · same builds · reproducible package.json first · cache for dependencies · faster builds second stage · build tools stay out · smaller USER node · no root · safer Found: API_KEY was set in the build → removed, passed at runtime.

Fill in

What you type stays in this browser window. We store and send nothing.

Paste the Dockerfile – remove keys and passwords first
What runs in the container?
What matters most to you?

Your prompt

This is an instruction for an AI, not the result itself.

Where this prompt works

These AI tools are a good fit for this prompt:

How to use it

  1. Fill in the fields or tap a suggestion. Leave out names, addresses and other personal data.
  2. Copy the finished prompt into an AI tool of your choice.
  3. Build the new image locally once, compare size and build time and run the tests before you adopt it.

Why does this work?

The fixed order of checks covers the most common causes of large, slow or risky images. The table with reason and effect makes every change easy to follow in review.

Tips

  • After switching to a non-root user, check that the application can still write where it needs to, for example logs or temporary files.

Part of these agents

CI pipeline agent

Also a good fit

You may use our prompts freely, including at work. Please do not republish them as your own collection. We give no warranty for AI results; check them yourself. Terms of use