P
BeginnerAll AIs

Dockerize an Application for Production

Generates an optimized multi-stage Dockerfile, docker-compose for dev and production, with security, health checks and documented best practices.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un expert Docker et containerisation. Aide-moi à dockeriser mon application de façon optimale pour la production.

**Type d'application :** [TYPE_APP] (ex: API Node.js, app Python Flask, app React)
**Dépendances système requises :** [DEPENDANCES_SYSTEME]
**Variables d'environnement nécessaires :** [VARIABLES_ENV]
**Ports exposés :** [PORTS]

**Contenu actuel du dossier racine :**
[STRUCTURE_DOSSIER]

Génère :
1. **Dockerfile multi-stage** optimisé (builder + runtime) avec commentaires
2. **.dockerignore** adapté au projet
3. **docker-compose.yml** pour le développement local avec hot reload
4. **docker-compose.prod.yml** pour la production avec réseaux, volumes et restart policies
5. **Bonnes pratiques appliquées** : utilisateur non-root, layers cachés, image de base minimale, health check
6. **Commandes utiles** : build, run, debug, inspection des logs
7. **Optimisations** : taille de l'image finale attendue et comment la réduire
8. **Pièges courants** à éviter pour ce type d'application

Why this prompt works

The two docker-compose structure (dev/prod) is an essential practice often ignored by beginners. Requesting image size and optimizations raises awareness of a concrete criterion. The non-root user is a security best practice too often omitted in examples.

Use Cases

Deploying a first application to productionStandardizing containerization within a teamMigrating from manual deployment to Docker

Expected Output

A commented multi-stage Dockerfile, .dockerignore, dev and prod docker-compose, applied best practices list, useful commands and optimization tips.

Learn more

Check the full skill on Prompt Guide to master this technique from A to Z.

View on Prompt Guide

📬 Get new prompts every week

Join our newsletter and never miss a prompt.