dockergenome
v1.0.0
Published
AI-inspired Dockerfile optimization engine powered by evolutionary search.
Downloads
135
Maintainers
Readme
dockergenome
Evolve better Dockerfiles.
dockergenomeis an AI-inspired optimization engine that mutates Dockerfiles, benchmarks real image builds, and keeps the strongest genome.
npx dockergenome optimizeWhy it exists
Dockerfiles tend to accrete over time: extra layers, expensive cache misses, oversized base images, and package-manager leftovers. dockergenome treats your Dockerfile like a genome:
- analyze the source
- create safe variants
- build them with Docker
- measure real outcomes
- keep the best-performing result
The result is a smaller, cleaner Dockerfile without overwriting your original.
Features
- Automatic Dockerfile analysis — base image, layers, install commands, cache behavior, image-size risks
- Evolutionary optimization — image swaps, layer merging, cleanup insertion, dependency-copy reordering
- Real benchmarking — actual
docker buildtiming, image inspection, failure handling - Terminal-first UX — neon banner, spinners, mutation logs, leaderboard output
- Safe by default — original Dockerfile backup, no destructive overwrite, failed variants discarded
- Portfolio-ready artifacts — optimized Dockerfile, markdown report, and web landing page
Installation
npm install -g dockergenomeOr run directly:
npx dockergenome optimizeCommands
dockergenome analyze
dockergenome benchmark
dockergenome evolve
dockergenome compare
dockergenome optimize| Command | Purpose |
| --- | --- |
| analyze | Scan the current Dockerfile and surface risks |
| benchmark | Build and score the current Dockerfile |
| evolve | Generate and benchmark multiple candidate genomes |
| compare | Compare Dockerfile with Dockerfile.optimized |
| optimize | Run the full pipeline and write final artifacts |
Example session
◈ Genome scan complete
Base image: node:20
Layers: 3
RUN instructions: 2
COPY instructions: 1
Score: 64/100
◈ Evolution leaderboard
Variant Status Time Size Layers Score
-----------------------------------------------------------
g1-v2 PASS 23104 212.40MB 2 550.72
seed PASS 24780 382.81MB 3 205.18Output files
Dockerfile.optimizedgenome-report.mdbenchmark-summary.jsonDockerfile.backup
Architecture
flowchart LR
A["CLI"] --> B["Analyzer"]
A --> C["Evolution Engine"]
C --> D["Mutator"]
C --> E["Benchmark Runner"]
E --> F["Docker CLI"]
C --> G["Leaderboard"]
G --> H["Markdown Report"]How it works
dockergenome intentionally uses conservative mutations:
- swap known large base images for slim equivalents
- merge
RUNlayers where safe - add package-manager cache cleanup
- split dependency-manifest copies from application copies to improve cache reuse
Each candidate is built in isolation. Failed builds are preserved in the leaderboard as failed experiments, but they are never selected as the winning genome.
Screenshot placeholders
Add terminal captures here after your first real benchmark run.
docs/screenshots/leaderboard.pngdocs/screenshots/report.pngdocs/screenshots/landing-page.png
Development
npm install
npm run build
npm run dev -- optimizeRoadmap
- configurable mutation strategies
- support for multi-objective scoring profiles
- Docker BuildKit cache metrics
- runtime benchmark hooks
- richer diff output between candidate genomes
- OCI registry publishing workflows
Future AI ideas
- LLM-assisted mutation proposals
- historical learning from previous runs
- workload-aware optimization profiles
- autonomous remediation suggestions for build failures
License
MIT
