deps_rocker.simple_rocker_extension =================================== .. py:module:: deps_rocker.simple_rocker_extension Classes ------- .. autoapisummary:: deps_rocker.simple_rocker_extension.SimpleRockerExtensionMeta deps_rocker.simple_rocker_extension.SimpleRockerExtension Functions --------- .. autoapisummary:: deps_rocker.simple_rocker_extension.get_workspace_path Module Contents --------------- .. py:function:: get_workspace_path() -> pathlib.Path Get the workspace directory path. Returns the current working directory where rocker is invoked. This is typically where the user's project files are located. :returns: The workspace directory path :rtype: Path .. py:class:: SimpleRockerExtensionMeta Bases: :py:obj:`type` Use a metaclass to dynamically create the static register_argument() function based on the class name and docstring .. py:class:: SimpleRockerExtension Bases: :py:obj:`rocker.extensions.RockerExtension` A class to take care of most of the boilerplace required for a rocker extension .. py:property:: builder_output_dir .. py:property:: builder_stage .. py:method:: _with_builder_defaults(raw: dict) -> dict .. py:property:: empy_args_with_builder .. py:property:: empy_builder_args_with_builder .. py:attribute:: name :value: 'simple_rocker_extension' .. py:attribute:: empy_args .. py:attribute:: empy_user_args .. py:property:: empy_builder_args .. py:attribute:: depends_on_extension :type: tuple[str, Ellipsis] :value: () .. py:attribute:: apt_packages :type: list[str] :value: [] .. py:attribute:: builder_apt_packages :type: list[str] :value: [] .. py:attribute:: builder_output_root :value: '/opt/deps_rocker' .. py:method:: get_name() -> str :classmethod: .. py:method:: _get_pkg() .. py:method:: get_snippet(cliargs) -> str Get a dockerfile snippet to be executed as ROOT. .. py:method:: get_user_snippet(cliargs) -> str Get a dockerfile snippet to be executed after switchingto the expected USER. .. py:method:: get_preamble(cliargs) .. py:method:: get_builder_snippet(cliargs) -> str .. py:method:: get_and_expand_empy_template(cliargs, empy_args=None, snippet_prefix='') Loads and expands an empy template snippet for Dockerfile generation. :param empy_args: Arguments to expand in the template :param snippet_prefix: Prefix for the snippet name (default: "") :returns: Expanded template string or empty string if not found/error .. py:method:: _log_empy_template_error(snippet_name, e) .. py:method:: _build_template_args(cliargs, empy_args=None) -> dict .. py:method:: get_builder_stage_name() -> str .. py:method:: get_builder_output_dir() -> str .. py:method:: register_arguments(parser: argparse.ArgumentParser, defaults: dict = None) :staticmethod: This gets dynamically defined by the metaclass .. py:method:: get_config_file(path: str) -> Optional[bytes] .. py:method:: register_arguments_helper(class_type: Type, parser: argparse.ArgumentParser, defaults: dict = None) -> None :staticmethod: Registers arguments for a given class type to an `ArgumentParser` instance. :param class_type: The class whose name and docstring are used to define the argument. The class must have a `name` attribute (str) and a docstring. :type class_type: Type :param parser: The `argparse.ArgumentParser` object to which the argument is added. :type parser: ArgumentParser :param defaults: A dictionary of default values for the arguments. If `None`, defaults to an empty dictionary. :type defaults: dict :returns: This method does not return any value. It modifies the `parser` in place. :rtype: None :raises AttributeError: If the `class_type` does not have a `name` attribute. .. py:method:: invoke_after(cliargs: dict) -> set[str] Returns a set of extensions that this extension should be invoked after. For SimpleRockerExtension, this returns the dependencies. .. py:method:: required(cliargs: dict) -> set[str] Returns a set of dependencies required by this extension. If deps is defined, returns it as a set. .. py:attribute:: get_workspace_path .. py:method:: get_apt_command(packages: list[str], use_cache_mount: bool = None) -> str :staticmethod: Generate an apt install command with optional cache mount for BuildKit. :param packages: List of apt packages to install :param use_cache_mount: Whether to use BuildKit cache mounts (None=auto-detect, True=force, False=disable) :returns: Complete RUN command string for Dockerfile