docker_pkg.builder¶
Workflow to process, build and publish image definitions
Classes
|
Scans the filesystem for image declarations, and build them |
|
Finite state machine |
- class docker_pkg.builder.ImageFSM(root: str, client: DockerClient, config: Dict, nocache: bool = True, pull: bool = True)[source]¶
Bases:
object
Finite state machine
- STATE_PUBLISHED = 'published'¶
Image is in the target Docker registry
- STATE_VERIFIED = 'verified'¶
Image has been verified.
- STATE_BUILT = 'built'¶
Image is in the local Docker daemon
- STATE_TO_BUILD = 'to_build'¶
Image could not be found in the registry or the daemon
- STATE_ERROR = 'error'¶
Error state, for examples a failure to build locally or to publish it to the registry
- STATES = ['published', 'built', 'to_build', 'verified', 'error']¶
List of possible states
- property label: str¶
The full label of the image, $registry/$ns/$name:$tag
- property name: str¶
The image full name, $registry/$ns/$name
- all_children() List[ImageFSM] [source]¶
Report all images that are born of the current one.
The result will include the current image, and all of their direct and indirect children. No logical loop protection is present here, nor the ordering is guaranteed in any ways.
Returns: (list) A list of all images that include the current one.
- class docker_pkg.builder.DockerBuilder(directory: str, config: Dict[str, Any], selection: Optional[str] = None, nocache: bool = True, pull: bool = True)[source]¶
Bases:
object
Scans the filesystem for image declarations, and build them
- scan(max_workers: int = 1)[source]¶
Scan the desired directory for dockerfiles, add them all to a build chain
max_workers: maximum number of threads to use when scanning local definition of images. For each image found,
scan
triggers queries to the local Docker daemon and the registry. Passed to concurrent.futures.ThreadPoolExecutor(). Default: 1.
- prune_chain() List[ImageFSM] [source]¶
Returns the images that need to be pruned, in the correct order.
- pull_dependencies(fsm: ImageFSM)[source]¶
Pulls all dependencies from the docker registry, if they’re present