şaka falan yapıyo olmanız lazım bu kadarı pes dedirtiyo artık devops engineer ve bunu 2025 te mi fark etmiş aq
Reduced Docker image size from 2.1GB to 180MB. Deployments 8x faster.
The original Dockerfile:
- Started with ubuntu:latest
- Installed everything via apt
- Included dev dependencies
- Copied entire project directory
- Left build artifacts
- No layer optimization
The problems:
- Pull time: 6-8 minutes
- Registry storage costs high
- Deployment took forever
- Security scan found 47 vulnerabilities
- Most from unnecessary packages
What we optimized:
1. Base image
- ubuntu:latest (2.1GB) → alpine:latest (5MB)
2. Dependencies
- Removed dev dependencies
- Multi-stage build
- Only production packages
3. Layer caching
- Copied requirements first
- Installed dependencies
- Then copied source code
- Leveraged Docker layer cache
4. .dockerignore
- Excluded .git, tests, docs
- Removed 800MB of files
The new image: 180MB
The impact:
- Pull time: 6min → 45sec
- Build time: 8min → 2min
- Deploy frequency: 2x per day → 15x per day
- Registry costs: $340/month → $60/month
- Security vulnerabilities: 47 → 3
- Kubernetes pod startup: 90sec → 12sec
Every MB in your image costs time and money. Optimize Docker images like you optimize code.