BeginnerAll AIs
Dockerize an application for production
Generate an optimized multi-stage Dockerfile, a 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. The request for image size and optimizations raises awareness of a concrete criterion. The non-root user is a good security practice too often omitted in examples.
Use Cases
Deploy a first application to productionStandardize containerization within a teamMigrate from manual deployment to Docker
Expected Output
Commented multi-stage Dockerfile, .dockerignore, dev and prod docker-compose, list of applied best practices, 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