Example #1
0
def build_image_using_hosts_docker(build_image,
                                   source,
                                   image,
                                   target_registries=None,
                                   push_buildroot_to=None,
                                   target_registries_insecure=False,
                                   dont_pull_base_image=False,
                                   **kwargs):
    """
    build image from provided dockerfile (specified by `source`) in privileged container
    using docker from host

    :param build_image: str, image where target image should be built
    :param source: dict, where/how to get source code to put in image
    :param image: str, tag for built image ([registry/]image_name[:tag])
    :param target_registries: list of str, list of registries to push image to (might change in
                              future)
    :param push_buildroot_to: str, repository where buildroot should be pushed
    :param target_registries_insecure: bool, allow connecting to target registries over plain http
    :param dont_pull_base_image: bool, don't pull or update base image specified in dockerfile

    :return: BuildResults
    """
    build_json = _prepare_build_json(image, source, target_registries,
                                     target_registries_insecure,
                                     dont_pull_base_image, **kwargs)
    m = DockerhostBuildManager(build_image, build_json)
    build_response = m.build()
    if push_buildroot_to:
        m.commit_buildroot()
        m.push_buildroot(push_buildroot_to)
    return build_response
Example #2
0
def build_image_using_hosts_docker(build_image, source, image,
        parent_registry=None, target_registries=None, push_buildroot_to=None,
        parent_registry_insecure=False, target_registries_insecure=False,
        dont_pull_base_image=False, **kwargs):
    """
    build image from provided dockerfile (specified by `source`) in privileged container
    using docker from host

    :param build_image: str, image where target image should be built
    :param source: dict, where/how to get source code to put in image
    :param image: str, tag for built image ([registry/]image_name[:tag])
    :param parent_registry: str, registry to pull base image from
    :param target_registries: list of str, list of registries to push image to (might change in future)
    :param push_buildroot_to: str, repository where buildroot should be pushed
    :param parent_registry_insecure: bool, allow connecting to parent registry over plain http
    :param target_registries_insecure: bool, allow connecting to target registries over plain http
    :param dont_pull_base_image: bool, don't pull or update base image specified in dockerfile

    :return: BuildResults
    """
    build_json = _prepare_build_json(image, source, parent_registry, target_registries,
                                     parent_registry_insecure, target_registries_insecure,
                                     dont_pull_base_image, **kwargs)
    m = DockerhostBuildManager(build_image, build_json)
    build_response = m.build()
    if push_buildroot_to:
        m.commit_buildroot()
        m.push_buildroot(push_buildroot_to)
    return build_response