Skip to main content

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
  • 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

  1. Run dockerfile-assistant
  2. Select Config from the menu
  3. Set your Provider (OpenAI, Anthropic, Google, Groq, or Ollama)
  4. Set your API Key (not required for Ollama)
  5. Set your Model name
  6. 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 .env files - 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

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

dockerfile_assistant-1.3.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dockerfile_assistant-1.3.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file dockerfile_assistant-1.3.0.tar.gz.

File metadata

  • Download URL: dockerfile_assistant-1.3.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dockerfile_assistant-1.3.0.tar.gz
Algorithm Hash digest
SHA256 d83375450451d89149fd63f4da305542ef0c2ca23323af071671e7fd2052da4f
MD5 e3ed33bf51e832a9cf7ee935fef1ffae
BLAKE2b-256 f0ad38d5a8bbebf8b588b838acc129ef78e506aa02eee24a260799292e0870f7

See more details on using hashes here.

File details

Details for the file dockerfile_assistant-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dockerfile_assistant-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00cb76bf6d1b5c1c45fc1b33564aa0c8eebdd4748cf14f8310ee6df1d954f8f1
MD5 f50de89703ff8244ad8fd3f05fd99b26
BLAKE2b-256 19393a8271bcdca6781abef35d33c71c7281a907f9231a1a90dac38e24040e70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page