
Gitcontainer ๐ณ
Turn any GitHub repository into a production-ready Docker container with AI-powered Dockerfile generation.
Gitcontainer is an AI-powered web application that automatically generates production-ready Dockerfiles by analyzing GitHub repositories. Simply paste a GitHub URL and get a tailored Dockerfile with intelligent base image selection, dependency management, and Docker best practices.
๐ Quick Access
Simply replace github.com with gitcontainer.com in any GitHub repository URL to instantly access the Dockerfile generation page for that repository.
For example:
https://github.com/username/repo โ https://gitcontainer.com/username/repo
โจ Features
- ๐ Instant URL Access: Just replace 'github.com' with 'gitcontainer.com' in any GitHub URL
- ๐ค AI-Powered Analysis: Uses OpenAI GPT-4 to analyze repository structure and generate intelligent Dockerfiles
- โก Real-time Streaming: Watch the AI generate your Dockerfile in real-time with WebSocket streaming
- ๐ฏ Smart Detection: Automatically detects technology stacks (Python, Node.js, Java, Go, etc.)
- ๐ง Production-Ready: Generates Dockerfiles following best practices with proper security, multi-stage builds, and optimization
- ๐ Additional Instructions: Add custom requirements for specialized environments
- ๐ Docker Compose: Automatically suggests docker-compose.yml for complex applications
- ๐จ Modern UI: Clean, responsive interface with Monaco editor for syntax highlighting
- ๐ฑ Mobile Friendly: Works seamlessly on desktop and mobile devices
๐ Quick Start
Prerequisites
- Python 3.9 or higher
- Git
- OpenAI API key
Installation
Clone the repository:
git clone https://github.com/cyclotruc/gitcontainer.git
cd gitcontainer
Install dependencies:
pip install -r requirements.txt
Set up environment variables:
# Create .env file
echo "OPENAI_API_KEY=your_openai_api_key_here" > .env
Run the application:
python app.py
Open your browser:
Navigate to http://localhost:8000
๐ ๏ธ How It Works
- URL Processing: Access any repository by replacing 'github.com' with 'gitcontainer.com' in the URL
- Repository Cloning: Gitcontainer clones the GitHub repository locally using Git
- Code Analysis: Uses gitingest to analyze the repository structure and extract relevant information
- AI Generation: Sends the analysis to OpenAI GPT-4 with specialized prompts for Dockerfile generation
- Smart Optimization: The AI considers:
- Technology stack detection
- Dependency management
- Security best practices
- Multi-stage builds when beneficial
- Port configuration
- Environment variables
- Health checks
๐ Project Structure
cyclotruc-gitcontainer/
โโโ app.py # Main FastAPI application
โโโ requirements.txt # Python dependencies
โโโ .env # Environment variables (create this)
โโโ static/ # Static assets (icons, CSS)
โโโ templates/
โ โโโ index.jinja # Main HTML template
โโโ tools/ # Core functionality modules
โโโ __init__.py
โโโ create_container.py # AI Dockerfile generation
โโโ git_operations.py # GitHub repository cloning
โโโ gitingest.py # Repository analysis
๐ง Configuration
Environment Variables
| Variable |
Description |
Required |
OPENAI_API_KEY |
Your OpenAI API key |
Yes |
PORT |
Server port (default: 8000) |
No |
HOST |
Server host (default: 0.0.0.0) |
No |
Advanced Usage
You can use the tools programmatically:
from tools import clone_repo_tool, gitingest_tool, create_container_tool
import asyncio
async def generate_dockerfile(github_url):
# Clone repository
clone_result = await clone_repo_tool(github_url)
# Analyze with gitingest
analysis = await gitingest_tool(clone_result['local_path'])
# Generate Dockerfile
dockerfile = await create_container_tool(
gitingest_summary=analysis['summary'],
gitingest_tree=analysis['tree'],
gitingest_content=analysis['content']
)
return dockerfile
# Usage
result = asyncio.run(generate_dockerfile("https://github.com/user/repo"))
print(result['dockerfile'])
๐จ Customization
Adding Custom Instructions
Use the "Additional instructions" feature to customize generation:
"Use Alpine Linux for smaller image size"
"Include Redis and PostgreSQL"
"Optimize for production deployment"
"Add development tools for debugging"
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
๐ Links
Made with โค๏ธ by Romain Courtois
Turn any repository into a container in seconds!