Dockerfile generator prompt for any stack
Generate a production-ready, multi-stage Dockerfile for your language and framework, including a non-root user setup.
متى تستخدم هذا البرومبت
- When containerizing a project for the first time.
- When your image is too large or slow to build.
- When standardizing Dockerfiles across microservices.
نص البرومبت
Write a production-ready Dockerfile for a {{language}} app using {{framework}}. Use multi-stage builds where useful, minimize image size, and run as a non-root user. Notes: {{focus}}.
{{CLIPBOARD}}{{language}}{{framework}}{{focus}}{{CLIPBOARD}}الكتلة {{CLIPBOARD}} تُستبدل تلقائياً بما نسخته قبل الضغط على «نسخ».
كيف تستخدمه
- انسخ البرومبت بالزر أو املأ المتغيرات أولاً.
- الصقه في ChatGPT أو Claude أو Gemini.
- عدّل النتيجة أو أعد الطلب بتغيير المتغيرات.
مثال على النتيجة
FROM node:20-slim AS build WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build FROM node:20-slim WORKDIR /app RUN useradd -m appuser COPY --from=build /app/dist ./dist COPY --from=build /app/node_modules ./node_modules USER appuser CMD [\"node\", \"dist/index.js\"]
نصائح للاستخدام
- Mention your package manager (npm, pip, poetry, cargo) so install steps match.
- Ask for a .dockerignore file alongside the Dockerfile to keep the build context small.
- If deploying to a specific platform (Cloud Run, ECS), mention it for port/env conventions.
النماذج الموصى بها
Claude
أسئلة شائعة
- Will it include a .dockerignore file?
- Ask for one explicitly; the default output focuses on the Dockerfile itself.
- Does it handle environment variables and secrets?
- It will reference ENV/ARG placeholders, but never paste real secret values into the prompt or the Dockerfile.