예제 #1
0
def main(cli_args):
    builder_args = node_parser.parse_args(cli_args)
    logger.setup_logging(builder_args)
    with ftl_util.Timing("full build"):
        with ftl_util.Timing("builder initialization"):
            node_ftl = node_builder.Node(
                context.Workspace(builder_args.directory), builder_args,
                _NODE_CACHE_VERSION)
        with ftl_util.Timing("build process for FTL image"):
            node_ftl.Build()
예제 #2
0
def main(cli_args):
    builder_args = php_parser.parse_args(cli_args)
    logger.setup_logging(builder_args)
    logger.preamble("php", builder_args)
    with ftl_util.Timing("full build"):
        with ftl_util.Timing("builder initialization"):
            php_ftl = php_builder.PHP(
                context.Workspace(builder_args.directory), builder_args,
                _PHP_CACHE_VERSION)
        with ftl_util.Timing("build process for FTL image"):
            php_ftl.Build()
def main(cli_args):
    builder_args = python_parser.parse_args(cli_args)
    logger.setup_logging(builder_args)
    with ftl_util.Timing("full build"):
        with ftl_util.Timing("builder initialization"):
            python_ftl = python_builder.Python(
                context.Workspace(builder_args.directory),
                builder_args,
                _PYTHON_CACHE_VERSION,
            )
        with ftl_util.Timing("build process for FTL image"):
            python_ftl.Build()
예제 #4
0
def main(cli_args):
    try:
        builder_args = php_parser.parse_args(cli_args)
        logger.setup_logging(builder_args)
        logger.preamble("php", builder_args)
        with ftl_util.Timing("full build"):
            with ftl_util.Timing("builder initialization"):
                php_ftl = php_builder.PHP(
                    context.Workspace(builder_args.directory), builder_args)
            with ftl_util.Timing("build process for FTL image"):
                php_ftl.Build()
    except ftl_error.UserError as e:
        ftl_error.UserErrorHandler(e, builder_args.builder_output_path)
    except ftl_error.InternalError as e:
        ftl_error.InternalErrorHandler(e, builder_args.builder_output_path)
예제 #5
0
def main(cli_args):
    try:
        builder_args = node_parser.parse_args(cli_args)
        logger.setup_logging(builder_args)
        logger.preamble("node", builder_args)
        with ftl_util.Timing("full build"):
            with ftl_util.Timing("builder initialization"):
                node_ftl = node_builder.Node(
                    context.Workspace(builder_args.directory), builder_args)
            with ftl_util.Timing("build process for FTL image"):
                node_ftl.Build()
    except ftl_error.UserError as u_err:
        ftl_error.UserErrorHandler(u_err, builder_args.log_path)
    except ftl_error.InternalError:
        ftl_error.InternalErrorHandler(builder_args.log_path)
        if builder_args.log_path:
            exit(0)
예제 #6
0
def main(args):
    args = parser.parse_args(args)
    logging.getLogger().setLevel(_LEVEL_MAP[args.verbosity])
    logging.basicConfig(
        format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
        datefmt='%Y-%m-%d,%H:%M:%S')
    transport = transport_pool.Http(httplib2.Http, size=_THREADS)

    # TODO(mattmoor): Support digest base images.
    base_name = docker_name.Tag(args.base)
    base_creds = docker_creds.DefaultKeychain.Resolve(base_name)

    target_image = docker_name.Tag(args.name)
    target_creds = docker_creds.DefaultKeychain.Resolve(target_image)

    ctx = context.Workspace(args.directory)
    cash = cache.Registry(target_image.as_repository(),
                          target_creds,
                          transport,
                          threads=_THREADS,
                          mount=[base_name])
    bldr = builder.From(ctx)
    with docker_image.FromRegistry(base_name, base_creds,
                                   transport) as base_image:

        # Create (or pull from cache) the base image with the
        # package descriptor installation overlaid.
        logging.info('Generating dependency layer...')
        with bldr.CreatePackageBase(base_image, cash, args.cache) as deps:
            # Construct the application layer from the context.
            logging.info('Generating app layer...')
            app_layer, diff_id = bldr.BuildAppLayer()
            with append.Layer(deps, app_layer, diff_id=diff_id) as app_image:
                if args.output_path:
                    with tarfile.open(name=args.output_path, mode='w') as tar:
                        save.tarball(target_image, app_image, tar)
                    logging.info("{0} tarball located at {1}".format(
                        str(target_image), args.output_path))
                    return
                with docker_session.Push(target_image,
                                         target_creds,
                                         transport,
                                         threads=_THREADS,
                                         mount=[base_name]) as session:
                    logging.info('Pushing final image...')
                    session.upload(app_image)
예제 #7
0
def main(cli_args):
    try:
        version.parse_known_args(cli_args)
        builder_args = node_parser.parse_args(cli_args)
        logger.setup_logging(builder_args)
        logger.preamble("node", builder_args)
        with ftl_util.Timing("full build"):
            with ftl_util.Timing("builder initialization"):
                node_ftl = node_builder.Node(
                    context.Workspace(builder_args.directory), builder_args)
            with ftl_util.Timing("build process for FTL image"):
                node_ftl.Build()
    except ftl_error.UserError as e:
        ftl_error.UserErrorHandler(e, builder_args.builder_output_path,
                                   builder_args.fail_on_error)
    except ftl_error.InternalError as e:
        ftl_error.InternalErrorHandler(e, builder_args.builder_output_path,
                                       builder_args.fail_on_error)
예제 #8
0
def main(args):
    args = parser.parse_args(args)
    logging.getLogger().setLevel(_LEVEL_MAP[args.verbosity])

    transport = transport_pool.Http(httplib2.Http, size=_THREADS)

    # TODO(mattmoor): Support digest base images.
    base_name = docker_name.Tag(args.base)
    base_creds = docker_creds.DefaultKeychain.Resolve(base_name)

    target_image = docker_name.Tag(args.name)
    target_creds = docker_creds.DefaultKeychain.Resolve(target_image)

    ctx = context.Workspace(args.directory)
    cash = cache.Registry(target_image.as_repository(),
                          target_creds,
                          transport,
                          threads=_THREADS,
                          mount=[base_name])
    bldr = builder.From(ctx)
    with docker_image.FromRegistry(base_name, base_creds,
                                   transport) as base_image:

        # Create (or pull from cache) the base image with the
        # package descriptor installation overlaid.
        logging.info('Generating dependency layer...')
        with bldr.CreatePackageBase(base_image, cash) as deps:
            # Construct the application layer from the context.
            logging.info('Generating app layer...')
            app_layer, diff_id = bldr.BuildAppLayer()
            with append.Layer(deps, app_layer, diff_id=diff_id) as app_image:
                with docker_session.Push(target_image,
                                         target_creds,
                                         transport,
                                         threads=_THREADS,
                                         mount=[base_name]) as session:
                    logging.info('Pushing final image...')
                    session.upload(app_image)