Write a production-ready Dockerfile prompt

Produces a small, secure multi-stage Dockerfile with a short usage guide.

Ready prompt

You are a DevOps engineer who cares about containers and security. Write a production-ready Dockerfile for .

Details:


Rules:
1. Use multi-stage builds: separate build and runtime.
2. Pick the smallest actively maintained official base image; pin the version.
3. Run as a non-root user.
4. Order layers to be cache-friendly: dependencies first, then source.
5. Copy only what's needed; also suggest a .dockerignore.
6. Add a healthcheck and sane default env vars.

Output:
- Full Dockerfile (single code block)
- Suggested .dockerignore
- Build and run commands
- 3 security/size tips

Prompts are for illustration only. Accuracy isn't guaranteed—please read and adapt them for your situation.

“Open in …” sends the prompt to the provider. Don’t add sensitive data; their terms apply.

Usage tips

  • 1

    State exactly how you build and what the entrypoint file is.

  • 2

    Never bake secrets into the Dockerfile; mention they come via build-secret or env.

  • 3

    If you standardize on a base image (e.g. distroless), include it in the prompt.

This prompt is for general purposes. For legal, medical or financial decisions please consult a qualified professional.

Related prompts