AI-powered Dockerfile generation and analysis
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
Dockerfile Assistant
AI-powered CLI tool that generates production-ready Dockerfiles and .dockerignore files for Python and Node.js projects.
Features
- Multi-Provider LLM Support - OpenAI, Google (Gemini), Anthropic (Claude), Groq, and Ollama (local)
- Automatic Stack Detection - Detects Python/Node.js, package managers, entry points, and ports
- Production-Ready Templates - Multi-stage builds, non-root users, health checks
- Filesystem MCP Integration - Optional AI-powered file exploration and generation
- Interactive CLI - Chat-based interface with multi-turn conversations
Installation
pip install dockerfile-assistant
From Source
git clone https://github.com/giulianotesta7/dockerfile-assistant.git
cd dockerfile-assistant
pip install -e .
Configuration
Create a .env file in your working directory:
# Required
LLM_PROVIDER=openai # ollama/google/anthropic/groq
MODEL_NAME=gpt-4o-mini
# API Key (based on provider)
OPENAI_API_KEY=sk-...
# GOOGLE_API_KEY=...
# ANTHROPIC_API_KEY=...
# GROQ_API_KEY=...
# OLLAMA_BASE_URL=http://localhost:11434/v1
# Optional - Enable filesystem access for AI
USE_FS_MCP=false
# Only if USE_FS_MCP is set on true
PROJECT_PATH=/path/to/your/project
OUTPUT_PATH=/path/to/output
Supported Providers
| Provider | Model Examples | Required Variable |
|---|---|---|
openai |
gpt-4 | OPENAI_API_KEY |
google |
gemini-pro | GOOGLE_API_KEY |
anthropic |
claude-sonnet | ANTHROPIC_API_KEY |
groq |
llama-3.3-70b-versatile | GROQ_API_KEY |
ollama |
llama3.1:8b | OLLAMA_BASE_URL |
Usage
dockerfile-assistant
Mode Comparison
| Feature | Basic Mode | MCP Mode |
|---|---|---|
| User provides project info | Yes | Optional |
| Auto-detects stack | No | Yes |
| Auto-detects dependencies | No | Yes |
| Reads project files | No | Yes |
| Saves files to disk | No | Yes |
| Required env vars | LLM_PROVIDER, MODEL_NAME, API key |
+ PROJECT_PATH, OUTPUT_PATH |
Basic Mode
Required input: Describe your project to the agent (stack, package manager, port, start command).
If there is missing information, AI will ask you for:
- Stack (Python or Node.js)
- Package manager (pip, poetry, npm, yarn, pnpm)
- Container port
- Start command
Then generates a Dockerfile and .dockerignore.
Note: For Ollama,
llama3.1:8bwas used during development testing. TheOLLAMA_BASE_URLmust include/v1(e.g.,http://localhost:11434/v1).
MCP Mode (USE_FS_MCP=true)
Required input: Just ask "Generate a Dockerfile for my project" - the AI explores your project automatically.
When enabled, the AI can:
- Explore your project directory automatically (
PROJECT_PATH) - Detect stack from file signatures (package.json, requirements.txt, etc.)
- Find entry points and ports from configuration
- Save generated files directly to
OUTPUT_PATH(Dockerfile, .dockerignore)
# Set in .env
USE_FS_MCP=true
PROJECT_PATH=/path/to/your/project
OUTPUT_PATH=/path/to/your/project
Important: MCP mode requires a model that supports tool/function calling.
Note: Ollama with small models (< 30B parameters) is not recommended for MCP mode. Small local models may struggle with tool calling and file exploration, leading to unexpected behavior. For MCP mode, use larger models or cloud providers (OpenAI, Google, Anthropic).
Security: The AI cannot read or write
.envfiles. Access is blocked for security reasons.
Generated Dockerfile Features
All generated Dockerfiles include:
- Multi-stage builds for optimized image size
- Non-root user for security
- Health checks for container orchestration
- Optimized base images (python:3.12-slim, node:20-alpine)
Supported Stacks
| Stack | Package Managers |
|---|---|
| Python | pip, poetry |
| Node.js | npm, yarn, pnpm |
Environment Variables Reference
| Variable | Required | Description |
|---|---|---|
LLM_PROVIDER |
Yes | Provider: openai, google, anthropic, groq, ollama |
MODEL_NAME |
Yes | Model identifier for the provider |
OPENAI_API_KEY |
If openai | OpenAI API key |
GOOGLE_API_KEY |
If google | Google AI API key |
ANTHROPIC_API_KEY |
If anthropic | Anthropic API key |
GROQ_API_KEY |
If groq | Groq API key |
OLLAMA_BASE_URL |
If ollama | Ollama server URL |
USE_FS_MCP |
No | Enable filesystem MCP (true/false) |
PROJECT_PATH |
If MCP | Path to project directory |
OUTPUT_PATH |
If MCP | Path for output files |
Requirements
- Python 3.10+
- Node.js (only if using MCP filesystem features)
License
MIT License - see LICENSE for details.
Author
Giuliano Testa (@giulianotesta7)
Acknowledgments
- System prompts were crafted with the assistance of Claude (Anthropic)
- Built with Pydantic AI
Project details
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 dockerfile_assistant-1.1.0.tar.gz.
File metadata
- Download URL: dockerfile_assistant-1.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd7fae7e3c010e7a772967b9eb88cc3d371dfc442d599453c4d1881939eb57ad
|
|
| MD5 |
18e9e83bb08af1cf26a599f5a29ca490
|
|
| BLAKE2b-256 |
3afb85452b17af9913f4be7a560be29b46a6a33e4b44bfc580f865883b4291fa
|
File details
Details for the file dockerfile_assistant-1.1.0-py3-none-any.whl.
File metadata
- Download URL: dockerfile_assistant-1.1.0-py3-none-any.whl
- Upload date:
- Size: 14.3 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 |
59aa7c843d65249bb76cbaf24b917285e7b21f2f98c5e4708a52d4c34f95aaf4
|
|
| MD5 |
36ba567f55956958d12e933bb20771c7
|
|
| BLAKE2b-256 |
2f2a88423e6d62d39533c989fb8587fa3805f97066044e2ab5d4fc5765d8645b
|