This repository contains a curated set of production-ready, DevOps-focused, and highly optimized Dockerfiles for different kinds of applications and stacks.
The purpose is to provide learning resources and ready-to-use examples that demonstrate best practices for containerization, image optimization, and production deployment.
- Provide real-world Dockerfile examples for multiple technologies.
- Demonstrate multi-stage builds, image minimization, and secure production setups.
- Compare optimized vs non-optimized Dockerfiles.
- Offer DevOps patterns for CI/CD, caching, static serving, and deployment.
- Serve as a reference for building your own production-grade Docker images.
optimized-dockerfiles/
│
├── react-vite/
│ ├── Dockerfile -> Optimized production Dockerfile
│ ├── Dockerfile.basic -> Non-optimized beginner Dockerfile example
│ ├── nginx.conf -> Static server config
│ └── README.md -> Project-specific guide
│
├── node-api/ -> (upcoming)
├── python-flask/ -> (upcoming)
├── go-service/ -> (upcoming)
└── ...Each subfolder represents a standalone example project, with:
- An optimized Dockerfile
- A basic Dockerfile (for comparison)
- Configuration files (Nginx, etc.)
- A project-specific README
| Category | Stack / Technology | Status |
|---|---|---|
| Frontend | React + Vite | ✅ DONE |
| Frontend | Next.js (App Router + SSR) | ✅ DONE |
| Frontend | Angular (CSR + SSR) | ✅ DONE |
| Frontend | Vue 3 + Vite | 🔜 Coming soon |
| Frontend | SvelteKit | 🔜 Coming soon |
| Frontend | Astro (Partial SSR / Islands) | 🔜 Coming soon |
| Backend | Node.js (Express) | 🔜 Coming soon |
| Backend | Node.js (Fastify) | 🔜 Coming soon |
| Backend | Go (Fiber / Gin) | 🔜 Coming soon |
| Backend | Python (Flask) | 🔜 Coming soon |
| Backend | Python (FastAPI) | 🔜 Coming soon |
| Backend | Rust (Axum / Actix) | 🔜 Coming soon |
| DevOps | Production-grade Nginx configs | ✅ DONE |
| DevOps | Optimized Dockerfiles | ✅ DONE |
| DevOps | Non-optimized comparison builds | ✅ DONE |
| DevOps | CI/CD (GitHub Actions) | 🔜 Coming soon |
| DevOps | GitHub Pages documentation site | 🔄 In Progress |
| DevOps | Repo Logo + Badges | 🔄 In Progress |
| DevOps | Wiki pages (Examples & Tutorials) | 🔄 In Progress |
This repository follows production-grade principles:
Reduce final image size by separating build and runtime stages.
Using alpine, scratch, or distroless where applicable.
Frontend projects use Nginx instead of vite preview.
- Non-root users where possible
- Read-only filesystem
- Minimal OS footprint
All examples are built to:
- Be cache efficient
- Work well with GitHub Actions
- Push easily to Docker Hub
Soon you'll find:
- GitHub Actions templates for:
- Building Docker images
- Tagging releases
- Pushing to Docker Hub
- Multi-platform builds (
amd64,arm64)
Feel free to contribute:
- Additional optimized Dockerfiles
- Example microservices
- Improvements & patterns
- Tutorials and notes
MIT License — free to use, modify, and learn from.
Made with ❤️ by Firas Mosbahi
Focused on DevOps excellence and reproducible builds.
