Skip to content

base

Authors:

  • Mohamed Abidi (Bright Computing)

ContainerGenerator

Bases: object

The parent class for concrete container recipe and image generator. Subclasses have to provide at least template resolution and image creation logic.

build_image(recipe_path)

This method will be used on the concrete subclass to build the image using The path of the container recipe.

generate()

The entry point for container recipe and image generation. It starts by validating the needed tools are available using TOOLS class attribute. If the validation passes, it will generate the container recipe, and optionally build out of it the container.

generate_recipe()

This method will make use of resolve_template and resolve_template_data methods in order to generate the container recipe.

resolve_template()

This method should be implemented by the concrete subclass to return the correct template for the container recipe.

resolve_template_data()

This method should be implemented by the concrete subclass to return a dictionary of template data for container recipe generation.

validate()

A method that should contain all the validation logic for both container recipe (Singularity, Dockerfile, ...) and image generation.

validate_tools()

A method that gets called as part of image generation that uses TOOLS class attribute to check for the existence of the needed binary/tools on the host system.