This project has been archived by its maintainers, and is no longer receiving any updates.
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
- Interactive TUI - Menu-based configuration with persistent settings
- No .env Required - Configuration stored in
~/.config/dockerfile-assistant/config.json
Installation
pip install dockerfile-assistant
From Source
git clone https://github.com/giulianotesta7/dockerfile-assistant.git
cd dockerfile-assistant
pip install -e .
Usage
Navigate to your project directory and run:
cd /path/to/your/project
dockerfile-assistant
On first run, you'll see the configuration menu. Set up your provider, API key, and model before selecting a mode.
Main Menu
╭──────────────────────────────────────────────────────────────────────╮
│ ▓▓ │
│ ▒▒ ▒▒ ▒▒ ▐█▄▄█▌ Provider: Anthropic │
│ ░░ ░░ ░░ ░░ ▀██▀ Model: claude-sonnet-4-20250514 │
│ ▟███████████████▛ API Key: Set │
│ ████▄█████████▀ │
│ ▜███████████▀ │
│ │
│ Dockerfile Assistant │
│ Working on: ~/my-project │
╰──────────────────────────────────────────────────────────────────────╯
┌─ Select a mode ──────────────────────────────────────────────────────┐
│ > Analyze: Reads your project to generate a matching Dockerfile │
│ Describe: Generates a Dockerfile from your description │
│ Config: Configure provider, API key and model │
└──────────────────────────────────────────────────────────────────────┘
Mode Comparison
| Feature | Analyze | Describe |
|---|---|---|
| Auto-detects stack | Yes | No |
| Auto-detects dependencies | Yes | No |
| Reads project files | Yes | No |
| Saves files to disk | Yes | No |
| User provides project info | Optional | Yes |
Analyze Mode
The AI automatically:
- Explores your project directory
- Detects stack from file signatures (package.json, requirements.txt, etc.)
- Finds entry points and ports from configuration
- Generates and saves Dockerfile and .dockerignore
Just ask: "Generate a Dockerfile for my project"
Note: Requires a model that supports tool/function calling. Small local models (< 30B parameters) may struggle with file exploration.
Describe Mode
Provide information about:
- Stack (Python or Node.js)
- Package manager (pip, poetry, npm, yarn, pnpm)
- Container port
- Start command
The AI generates a Dockerfile based on your description.
Configuration
All configuration is stored in ~/.config/dockerfile-assistant/config.json and managed through the TUI.
First-Time Setup
- Run
dockerfile-assistant - Select Config from the menu
- Set your Provider (OpenAI, Anthropic, Google, Groq, or Ollama)
- Set your API Key (not required for Ollama)
- Set your Model name
- Press Back to return to the main menu
Supported Providers
| Provider | Model Examples | Documentation |
|---|---|---|
openai |
gpt-4o, gpt-4-turbo | OpenAI Models |
anthropic |
claude-sonnet-4-20250514 | Anthropic Models |
google |
gemini-2.0-flash | Google AI Models |
groq |
llama-3.3-70b-versatile | Groq Models |
ollama |
llama3.1:8b | Run ollama list locally |
Configuration File
Settings are stored in ~/.config/dockerfile-assistant/config.json:
{
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"ollama_base_url": "http://localhost:11434",
"api_keys": {
"openai": null,
"anthropic": "sk-ant-...",
"google": null,
"groq": null
}
}
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 |
Requirements
- Python 3.13+
- Node.js (only required for Analyze mode - filesystem MCP features)
Security
- The AI cannot read or write
.envfiles - access is blocked for security - API keys are stored locally in your home directory config file
- In Analyze mode, the AI only has access to the current working directory
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
Metadata
Release files for dockerfile-assistant 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dockerfile_assistant-1.3.0.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dockerfile_assistant-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.0 kB
Release files / dockerfile_assistant-1.3.0.tar.gz
| Download URL | dockerfile_assistant-1.3.0.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d83375450451d89149fd63f4da305542ef0c2ca23323af071671e7fd2052da4f
|
|
BLAKE2b-256 checksum How to use checksums |
f0ad38d5a8bbebf8b588b838acc129ef78e506aa02eee24a260799292e0870f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / dockerfile_assistant-1.3.0-py3-none-any.whl
| Download URL | dockerfile_assistant-1.3.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00cb76bf6d1b5c1c45fc1b33564aa0c8eebdd4748cf14f8310ee6df1d954f8f1
|
|
BLAKE2b-256 checksum How to use checksums |
19393a8271bcdca6781abef35d33c71c7281a907f9231a1a90dac38e24040e70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|