The Customizable AI Dockerfile Generation Framework
Project description
DockAI
AI-Powered Dockerfile Generation Framework
Generate production-ready Dockerfiles from first principles using AI agents
Quick Start • Features • Docs • CI/CD • Contributing
🎯 What is DockAI?
DockAI is an agentic AI framework that analyzes your codebase and generates optimized, production-ready Dockerfiles. Unlike template-based tools, DockAI uses first-principles reasoning to understand your application and create Dockerfiles from scratch—handling everything from standard stacks to legacy systems.
pip install dockai-cli
dockai build /path/to/project
That's it. DockAI handles the rest.
✨ Features
🧠 First-Principles AINo templates. Analyzes file structures, dependencies, and code patterns to deduce the optimal containerization strategy. |
🔄 Self-Correcting WorkflowBuilds and tests Dockerfiles in a sandbox. If something fails, AI reflects, learns, and retries with a new approach. |
🛡️ Security-FirstBuilt-in Trivy integration scans for vulnerabilities. Enforces non-root users, minimal base images, and hardened configs. |
🤖 10 Specialized AgentsEach agent handles a specific task: analysis, planning, generation, review, and more. All fully customizable. |
⚡ Multi-Provider LLMsSupports OpenAI, Azure OpenAI, Google Gemini, and Anthropic Claude. Mix models per agent for cost optimization. |
🔧 Fully CustomizableOverride prompts, instructions, and model selection per agent. Use |
🚀 Quick Start
Installation
pip install dockai-cli
Configuration
Create a .env file:
# Required: Choose your LLM provider and add the API key
OPENAI_API_KEY=sk-your-api-key
# Optional: Use a different provider (openai, azure, gemini, anthropic)
# DOCKAI_LLM_PROVIDER=openai
Usage
# Generate Dockerfile for your project
dockai build /path/to/project
# With verbose output
dockai build /path/to/project --verbose
🏗️ How It Works
graph TD
Start([▶ Start]) --> Scan[📂 Scanner]
Scan --> Analyze[🧠 Analyzer]
Analyze --> Read[📖 Reader]
Read --> Health[🏥 Health Detector]
Health --> Ready[⏱️ Readiness Detector]
Ready --> Plan[📝 Planner]
Plan --> Generate[⚙️ Generator]
Generate --> Review[🔒 Security Reviewer]
Review -- Secure --> Validate[✅ Validator]
Review -- Issues & Can Retry --> Reflect[🤔 Reflector]
Review -- Critical & Max Retries --> Fail([❌ Fail])
Validate -- Success --> End([🏁 Finish])
Validate -- Failure --> Reflect
Reflect --> Increment[🔄 Increment Retry]
Increment -- Fix Code --> Generate
Increment -- New Strategy --> Plan
Increment -- Re-Analyze --> Analyze
Increment -- Max Retries --> Fail
🤖 The 10 AI Agents
| Agent | Role | Model Type |
|---|---|---|
| Analyzer | Project discovery & stack detection | Fast |
| Planner | Strategic build planning | Fast |
| Generator | Dockerfile creation | Powerful |
| Generator (Iterative) | Debugging failed Dockerfiles | Powerful |
| Reviewer | Security audit & hardening | Fast |
| Reflector | Failure analysis & learning | Powerful |
| Health Detector | Health endpoint discovery | Fast |
| Readiness Detector | Startup pattern analysis | Fast |
| Error Analyzer | Error classification | Fast |
| Iterative Improver | Targeted fix application | Powerful |
⚙️ Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY |
OpenAI API key | Required* |
GOOGLE_API_KEY |
Google Gemini API key | Required* |
ANTHROPIC_API_KEY |
Anthropic Claude API key | Required* |
AZURE_OPENAI_API_KEY |
Azure OpenAI API key | Required* |
DOCKAI_LLM_PROVIDER |
Provider (openai, azure, gemini, anthropic) |
openai |
MAX_RETRIES |
Maximum retry attempts | 3 |
DOCKAI_SKIP_SECURITY_SCAN |
Skip Trivy scanning | false |
*Only one API key required for your chosen provider.
Repository-Level Configuration
Create a .dockai file in your project root:
[instructions_analyzer]
This is a Django application with Celery workers.
[instructions_generator]
Use gunicorn as the WSGI server.
Run database migrations at container start.
[instructions_reviewer]
All containers must run as non-root (UID >= 10000).
🔗 GitHub Actions
name: Auto-Dockerize
on:
push:
branches: [main]
jobs:
dockai:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: itzzjb/dockai@v2
with:
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
Multi-Provider Example
- uses: itzzjb/dockai@v2
with:
llm_provider: gemini
google_api_key: ${{ secrets.GOOGLE_API_KEY }}
max_retries: 5
strict_security: true
See GitHub Actions Guide for all options.
📖 Documentation
| Document | Description |
|---|---|
| Getting Started | Installation, configuration, first run |
| Architecture | Deep dive into the agentic workflow |
| Configuration | All environment variables and options |
| Customization | Tuning agents for your organization |
| API Reference | Module and function documentation |
| GitHub Actions | CI/CD integration guide |
| FAQ | Frequently asked questions |
💡 Platform Engineers: DockAI is ideal for embedding into Internal Developer Platforms, CI/CD pipelines, and self-service portals to auto-generate Dockerfiles at scale.
🛠️ Tech Stack
| Technology | Purpose |
|---|---|
| Python 3.10+ | Core runtime |
| LangGraph | Stateful agent workflow orchestration |
| LangChain | LLM provider integration |
| Pydantic | Structured output validation |
| Rich + Typer | Beautiful CLI interface |
| Trivy | Security vulnerability scanning |
🤝 Contributing
Contributions are welcome! Feel free to open issues and pull requests.
📄 License
MIT License - see LICENSE for details.
Built with ❤️ by itzzjb
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dockai_cli-2.1.1.tar.gz.
File metadata
- Download URL: dockai_cli-2.1.1.tar.gz
- Upload date:
- Size: 84.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
325c3a55b666652f76ebc9394ab0aaab5697f441ea69ceff8157823a30cc07d0
|
|
| MD5 |
b9d5680aa4a450d517392003573380ad
|
|
| BLAKE2b-256 |
f01dd51706d79ba18c39584d7b568f7002506bbfa4b6aff64feab79fb690cbc7
|
File details
Details for the file dockai_cli-2.1.1-py3-none-any.whl.
File metadata
- Download URL: dockai_cli-2.1.1-py3-none-any.whl
- Upload date:
- Size: 77.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc776bacf88f06c2a63a345f02d248f134b0fe0e84cd670394a4e78883355ea
|
|
| MD5 |
407f76b290fa0bb0309e9168db43223f
|
|
| BLAKE2b-256 |
c2c8545c477c2ed71562519f0f20c04a107258f8939416c6d876cf1a6cc7699a
|