DockerComposeAIGenerator is an AI-powered tool that automatically generates Dockerfile and docker-compose.yaml files for any GitHub repository, making containerization and deployment quick and easy.
A public demo version is available at: https://dockergen.jonte.au
Important Notes about the Demo:
- You must provide your own OpenAI API key to use the demo version
- Unlike the main version where the API key is defined in a server-side .env file, the demo requires users to input their key in the web interface
- The demo is based on the
demo-version
branch
This project takes a GitHub repository URL as input, analyzes its structure and content, and uses an AI model to generate appropriate Docker configuration files tailored to that specific project. It's perfect for developers who want to quickly containerize and deploy projects without spending time manually crafting Docker configurations.
AI Docker Generator WebUI showing generated Docker configurations for a GitHub repository
- One-Click Generation: Simply provide a GitHub URL and get ready-to-use Docker configurations
- Intelligent Analysis: Automatically identifies programming languages, frameworks, databases, and dependencies
- Production-Ready Outputs: Generates optimized multi-stage Dockerfiles when beneficial
- Smart Defaults: Includes sensible default configurations for environment variables, volumes, and networking
- Multiple AI Providers: Choose between OpenAI API or your local Ollama installation
The project consists of two main components:
-
API Backend (Python/FastAPI):
- Processes GitHub repositories using Repomix
- Communicates with OpenAI or Ollama models
- Generates and returns Docker configurations
-
Web Frontend (Next.js):
- Provides user interface for entering GitHub URLs
- Allows selection between OpenAI or Ollama as the AI provider
- Displays generated Docker configurations
- Allows copying or downloading of configuration files
- Python 3.9+
- Node.js 18+
- OpenAI API key (if using OpenAI as provider)
- Ollama installation (if using Ollama as provider)
-
Clone this repository:
git clone https://github.com/jontstaz/DockerComposeAIGenerator.git cd DockerComposeAIGenerator
-
Set up the API:
cd api # Create a virtual environment (optional but recommended) python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies pip install -r requirements.txt # Create a .env file with your OpenAI API key (only needed if using OpenAI) echo "OPENAI_API_KEY=your_api_key_here" > .env
-
Set up the web frontend:
cd ../web npm install # or if you use bun bun install
-
Start the API server:
cd api uvicorn main:app --reload
-
Start the web frontend:
cd web npm run dev # or if you use bun bun run dev
-
Open your browser and navigate to http://localhost:3000
-
Enter a GitHub repository URL, select your preferred AI provider (OpenAI or Ollama), and click "Generate"
- If using Ollama, make sure you have it running locally and have pulled your preferred model
-
Review the generated Dockerfiles and docker-compose.yaml
-
Copy or download the configuration files and use them in your project
You can easily deploy this application using Docker:
-
Copy the example environment file and set your OpenAI API key (if using OpenAI):
cp .env-example .env # Edit .env with your actual API key
-
Build and start the containers:
docker-compose up -d
-
Access the application at http://localhost:3000
-
To stop the containers:
docker-compose down
- The tool fetches and analyzes the GitHub repository using Repomix, which creates a semantic map of the project's structure and content
- This map is used as context for an AI model (OpenAI's GPT or a local Ollama model) that identifies the technologies used and the requirements for containerization
- The AI generates appropriate Docker configuration files based on the project's specific needs
- The generated files are presented to the user through the web interface
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request