miniogre

The minimalist way to dockerize any Python application.

miniogre is a command-line application that analyzes a Python project codebase and README file to automatically generate a Dockerfile, requirements.txt file, and SBOM files. This tool expedites the process of dockerizing any Python application.

How it Works

Upon running the application, it carries out the following steps:

  • The project directory is scrutinized to identify the primary code language.

  • The README file is located and read.

  • GPT-4 language model is used to predict the application dependencies and generate content for the requirements.txt file based on the README contents.

  • The requirements.txt, Dockerfile, and sbom.json files are created.

  • A Docker image of the application is built.

  • An ogre container is spun up.

Two main commands can be run, with the miniogre/main.py file serving as the entry point.

  • run: Executes a series of actions, including configuring directories and files (bashrc, Dockerfile), generating requirements, building a Docker image, and spinning up a container.

  • readme: Constructs a new README.md file that mirrors the operations observed within the source code.

Requirements

To use miniogre effectively, ensure the following are installed:

  • Python 3: Miniogre is developed in Python. If it's not already installed, get Python here.

  • Docker: Docker is a platform used to eliminate "works on my machine" problems when collaborating on code with co-workers. If it's not already installed, get Docker here.

  • pip or pipx: These are python package installers used to install miniogre. If they are not already installed, get pipx here or pip here.

  • An OpenAI token in the environment: export OPENAI_API_KEY=<YOUR_TOKEN>

Installation

Miniogre can be installed either by using pip or pipx:

pip install miniogre
pipx install miniogre

Usage

After installation, go inside the project folder and run:

miniogre run

This will analyze the project, generate ogre_dir/Dockerfile, ogre_dir/requirements.txt, and ogre_dir/sbom.json and build a Docker image.

There are other commands:

  • readme: Analyzes the source code to generate a new README.md file that is compatible with what actually happens in the source code.

Last updated