Programming & Dev
Advanced
DevOps Containerization Strategy
Using standard, unoptimized Docker images results in bloated images (1GB+) and severe security vulnerabilities. This DevOps prompt designs hardened, multi-staged build pipelines that compile code in isolated stages, leaving build tools behind and outputting production images under 100MB.
How to Run it
- Supply your framework language and compiler configurations (e.g., node 20 alpine, go 1.22, rust 1.78).
- Fill in application paths and port details.
Optimization Tips
- alpine vs slim: Alpine Linux is smaller but relies on musl instead of glibc. Slim variants are recommended if you have deep C-bindings.
- Docker Compose Limits: Set strict memory limits (e.g.,
mem_limit: 512m) in compose to prevent memory leaks from crashing the host machine.
Customize Prompt Parameters
AI Prompt Blueprint
Act as a Senior DevOps Engineer. For the application framework: [Insert Application Framework, e.g., Next.js, Go, Spring Boot], write a production-grade Dockerfile and docker-compose.yml configuration. The Dockerfile must utilize: 1. Strict multi-stage builds to minimize image sizes. 2. Non-root user execution directives (security isolation). 3. Execution caching for package dependencies (npm install/go mod download). 4. Healthcheck instruction sets. The compose file must specify environment file bindings, volumes for local development, restart policies, and resource limit constraints (CPU/memory limits).