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.2.1.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.2.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dockerfile_assistant-1.2.1.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.2.1.tar.gz
Algorithm Hash digest
SHA256 7dede17e704b89fd17686a826868e24fd04987e7444f098f0f3727252d551745
MD5 c7f5c6c83c808695bbc7e1f6026c897b
BLAKE2b-256 dbe16acd65e3d9741e1168c38db12c3214f0f2db1ad84dc128e54794ac26cbed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dockerfile_assistant-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0639804102f771e4373a26e32a6114664fbfa0efb23b2253ad0987a7b79d3470
MD5 553aad87c3d6e4de597b588844f01aa5
BLAKE2b-256 5db1ed322c431ce88ceda0a58ead505203c6dd0ed46f1cbc29a3f7f86086e4d6

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