🚀
Docker Multi-Stage Build Optimizer
Optimize Docker builds for smaller images and faster CI
prompt template
Optimize the Docker build for this application: **Application type:** [TYPE — e.g., "Next.js app", "Node.js API", "Python FastAPI"] **Current image size:** [SIZE — e.g., "1.2GB"] **Current build time:** [TIME — e.g., "8 minutes"] Generate an optimized Dockerfile with: 1. **Multi-stage build** — separate build, test, and production stages 2. **Layer caching** — order instructions for maximum cache reuse 3. **Minimal base image** — alpine or distroless with security justification 4. **Dependency caching** — cache node_modules/pip packages across builds 5. **Security hardening** — non-root user, read-only filesystem, no dev dependencies 6. **.dockerignore** — comprehensive ignore file to speed up context transfer 7. **Build arguments** — configurable for different environments Include the Dockerfile, .dockerignore, and docker-compose.yml for local dev. Target: production image under 200MB, build time under 3 minutes.
How to Use This Prompt
- 1Copy the prompt template above
- 2Paste into Claude, ChatGPT, or Cursor
- 3Replace [bracketed placeholders] with your specific project details
- 4Iterate on the AI output to refine and customize the results
More DevOps Prompts
Related devops templates from the vault
🚀
Kubernetes Pod Autoscaling Config
Use this prompt to kubernetes pod autoscaling config with AI assistance
Intermediatekubernetesautoscaling
🚀
GitOps Disaster Recovery Playbook
PROCreate a complete disaster recovery playbook for a GitOps-managed infrastructure with RTO and RPO targets
Advanceddevopsdisaster-recovery
🚀
Terraform Infrastructure Module
Use this prompt to terraform infrastructure module with AI assistance
Beginnerterraformiac
🚀
Observability Stack Setup
Set up comprehensive observability with logging, metrics, and tracing
Intermediateobservabilitymonitoring
You Might Also Like
Prompts from other categories that share similar tags
🐛
Debugging
Docker Container Debug Session
Use this prompt to docker container debug session with AI assistance
Shared:dockerdevops
🗄️
DatabasePRO
SQL Query Optimizer
Optimize slow SQL queries with explain analysis
Shared:optimization
⚡
Performance
Next.js Performance Optimization
Optimize a Next.js application for Core Web Vitals and loading speed
Shared:optimization
🧪
TestingPRO
E2E Test Scenario Writer
Write end-to-end test scenarios for user flows
Shared:ci-cd
Keep Exploring the Vault