This project provides a WebApp that automates the generation of Dockerfiles using a fine-tuned OpenAI model. It analyzes the structure of your repository, identifies dependency files, and generates tailored Dockerfiles based on the provided information.
- WebApp Interface: A user-friendly interface to interact with the application.
- Automatic Dependency Analysis: Scans the repository for files like
requirements.txt,package.json, and others to determine the dependencies. - ChatGPT Integration: Leverages a custom-trained OpenAI model trained on existing Dockerfile data to generate Dockerfiles better suited for the repository.
Here is a video link showcasing the example:
- Python 3.7 or higher.
- A valid OpenAI API key.
- Javascript
-
Clone the repository:
git clone <repository-url> cd <repository-folder>
-
Set the OpenAI API key: Export your OpenAI API key to the environment variable:
export OPENAI_API_KEY="your-openai-api-key"
-
Run the WebApp: Execute the
main.pyfile to start the application:python main.py
-
Access the WebApp: Open your browser and go to the following address:
http://127.0.0.1:5000 -
Generate Dockerfile:
- Upload your repository or point to a GitHub repository.
- The application will scan your repository for dependency files such as:
requirements.txtfor Pythonpackage.jsonfor Node.js- Any other recognized dependency file types
- If dependency files are found, they are sent via API to the fine-tuned OpenAI model to generate a Dockerfile.
- If no dependency files are found, the application will return a Dockerfile.
-
Repository Analysis:
- The application scans the repository’s root directory for dependency files.
- Files like
requirements.txt,package.json, and other relevant files are parsed to extract necessary information.
-
Dockerfile Generation:
- The extracted dependency data is sent to the OpenAI API using a fine-tuned model.
- The model generates a Dockerfile optimized for the detected dependencies and project structure.
-
WebApp Interface:
- Provides a clean and intuitive interface for users to upload repositories and view generated Dockerfiles.