Docker Containerization and Docker Compose Orchestration for Production
Optimized Dockerfiles and docker-compose for development and production environments.
Create a containerized environment that ensures parity between development and production, with optimized builds, multi-stage builds, and security configurations.
At a glance
Access
Free prompt
Open to copy without upgrading.
Prompt objective
Create a containerized environment that ensures parity between development and production, with optimized builds, multi-stage builds, and security configurations.
Real use case
A digital agency runs 8 projects on VPS with PM2. Each project has conflicting dependencies, new developer setup takes 2 days, and 'works on my machine' is the most common phrase. They need to migrate everything to Docker in 1 month.
Customize these fields first
Replace the placeholders with your own context before you run the prompt. That usually improves the first output more than adding more instructions later.
Prompt
Create the complete Docker configuration for [PROJECT NAME], composed of [SERVICE LIST: e.g. Next.js app, Node.js API, PostgreSQL, Redis, Nginx].\\\\\\\\n\\\\\\\\n**Context:**\\\\\\\\n- Dev environment: Mac M1/M2/M4 (ARM64)\\\\\\\\n- Production environment: VPS Linux (AMD64) with [RAM] memory\\\\\\\\n- Services: [DETAILED LIST]\\\\\\\\n- Persistent data volumes: [LIST]\\\\\\\\n\\\\\\\\n**1) Multi-stage Dockerfile for [MAIN APP]:**\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`dockerfile\\\\\\\\n# Stage 1: Dependencies\\\\\\\\n# Stage 2: Build\\\\\\\\n# Stage 3: Production (minimal image)\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\n- Optimized base image (alpine or distroless)\\\\\\\\n- Non-root user\\\\\\\\n- Complete .dockerignore\\\\\\\\n- Optimized layer caching (COPY package.json before code)\\\\\\\\n- Native Docker health check\\\\\\\\n- Labels with metadata (version, maintainer)\\\\\\\\n- Build args for compile-time variables\\\\\\\\n- Multi-platform: linux/amd64 + linux/arm64\\\\\\\\n\\\\\\\\n**2) docker-compose.yml (Development):**\\\\\\\\n- Hot reload with mounted volumes\\\\\\\\n- Mapped ports for local access\\\\\\\\n- depends_on with health checks\\\\\\\\n- Profiles for optional services (mailhog, adminer)\\\\\\\\n- Variables via .env file\\\\\\\\n\\\\\\\\n**3) docker-compose.prod.yml (Production):**\\\\\\\\n- No code volumes (self-contained image)\\\\\\\\n- Restart policies (unless-stopped)\\\\\\\\n- Resource limits (cpus, memory)\\\\\\\\n- Configured logging driver (json-file with rotation)\\\\\\\\n- Isolated networks (frontend, backend, database)\\\\\\\\n- Secrets management (Docker secrets or encrypted .env)\\\\\\\\n\\\\\\\\n**4) Reverse Proxy (Nginx or Traefik):**\\\\\\\\n- Automatic HTTPS with Let's Encrypt\\\\\\\\n- Gzip/Brotli compression\\\\\\\\n- Rate limiting\\\\\\\\n- Security headers\\\\\\\\n- WebSocket support (if needed)\\\\\\\\n\\\\\\\\n**5) Helper Scripts:**\\\\\\\\n- \\\\\\\\\\\\\\\\\\\\\\\`make dev\\\\\\\\\\\\\\\\\\\\\\\` — start development environment\\\\\\\\n- \\\\\\\\\\\\\\\\\\\\\\\`make build\\\\\\\\\\\\\\\\\\\\\\\` — production build\\\\\\\\n- \\\\\\\\\\\\\\\\\\\\\\\`make deploy\\\\\\\\\\\\\\\\\\\\\\\` — zero-downtime deployment (rolling update)\\\\\\\\n- \\\\\\\\\\\\\\\\\\\\\\\`make backup\\\\\\\\\\\\\\\\\\\\\\\` — data volume backups\\\\\\\\n- \\\\\\\\\\\\\\\\\\\\\\\`make logs\\\\\\\\\\\\\\\\\\\\\\\` — aggregated logs with service filtering\\\\\\\\n\\\\\\\\n**6) Security:**\\\\\\\\n- Image vulnerability scanning (Trivy/Snyk)\\\\\\\\n- Principle of least privilege\\\\\\\\n- Read-only filesystem where possible\\\\\\\\n- No extra capabilities\\\\\\\\n\\\\\\\\nProvide all complete files and a README with setup instructions.
Open directly in an AI — the text is pre-filled:
How to use this prompt
- 1Replace the key placeholders first: PROJECT NAME, SERVICE LIST: e.g. Next.js app, Node.js API, PostgreSQL, Redis, Nginx, RAM, DETAILED LIST.
- 2Replace any bracketed placeholders like [this] with your own context.
- 3Add extra background information when you want more tailored results.
- 4Combine multiple prompts in one conversation when you need a richer output.
- 5Save your best-performing prompts so they are easy to reuse later.
Next best step
Open the guide first, then branch only if you still need more.
A guide for technical builders choosing between prompts, coding workflows, and agent-based implementation.
If this prompt is close but not quite right, generate variants next. If the job is recurring, move into the course library after the guide.
Related prompts
View allComplete CI/CD Pipeline with GitHub Actions for Next.js Applications
Automated pipeline configuration with tests, build, preview deploys, and production deployment.
Best for
Automate the entire software delivery lifecycle with GitHub Actions, from push to production deployment, including tests, code analysis, and preview environments.
Monitoring and Observability Setup with Grafana, Prometheus, and Alerts
Complete monitoring stack setup with metrics, logs, and alerts for production applications.
Best for
Implement full observability that detects issues before users notice them, with actionable dashboards and intelligent alerting.
Infrastructure as Code with Terraform for AWS/Hetzner
Automated cloud infrastructure provisioning with Terraform, reusable modules, and state management.
Best for
Automate provisioning of all infrastructure required for a production application, ensuring reproducibility, version control, and compliance.
Incident Response Playbook for Engineering Teams
Structured process for detection, response, communication, and postmortem for production incidents.
Best for
Establish a clear incident response process that minimizes detection and resolution time (MTTR), protects user experience, and generates learnings for the team.
Explore other prompt categories
Move sideways into adjacent libraries when the current category is not the full answer.
Free browsing stays open. Premium prompts unlock the reusable workflow layer.
Use the guides and role paths to validate the job first. Upgrade when you want the full prompt text, editable premium prompts, and the surrounding course paths in one place.
Free access
- Browse guides, role paths, and category pages.
- Preview prompts before you decide to upgrade.
- Find the right starting point without friction.
Membership access
- Unlock premium prompts and the full copy text.
- See more workflow paths and course connections.
- Keep the reusable templates in one place.