def main()

in sagemaker_studio_image_build/cli.py [0:0]


def main():

    parser = argparse.ArgumentParser(
        description="A command line interface for building Docker images in SageMaker Studio "
        "using AWS CodeBuild and pushing to Amazon ECR"
    )
    subparsers = parser.add_subparsers(dest="subcommand")

    build_parser = subparsers.add_parser(
        "build",
        help="Use AWS CodeBuild to build a Docker image and push to Amazon ECR",
    )
    build_parser.add_argument(
        "--repository",
        help="The ECR repository:tag for the image (default: sagemaker-studio-${domain_id}:latest)",
    )
    build_parser.add_argument(
        "--compute-type",
        help="The CodeBuild compute type (default: BUILD_GENERAL1_SMALL)",
        choices=["BUILD_GENERAL1_SMALL", "BUILD_GENERAL1_MEDIUM",
                 "BUILD_GENERAL1_LARGE", "BUILD_GENERAL1_2XLARGE"],
        default="BUILD_GENERAL1_SMALL"
    )
    build_parser.add_argument(
        "--role",
        help=f"The IAM role name for CodeBuild to use (default: the Studio execution role).",
    )
    build_parser.add_argument(
        "--bucket",
        help="The S3 bucket to use for sending data to CodeBuild (if None, use the SageMaker SDK default bucket).",
    )
    build_parser.add_argument(
        "--vpc-id",
        help="The Id of the VPC that will host the CodeBuild Project (such as vpc-05c09f91d48831c8c).",
    )
    build_parser.add_argument(
        "--subnet-ids",
        help="The comma-separated list of subnet ids for the CodeBuild Project (such as subnet-0b31f1863e9d31a67)",
    )
    build_parser.add_argument(
        "--security-group-ids",
        help="The comma-separated list of security group ids for the CodeBuild Project (such as sg-0ce4ec0d0414d2ddc).",
    )
    build_parser.add_argument(
        "--no-logs",
        action="store_true",
        help="Don't show the logs of the running CodeBuild build",
    )
    build_parser.set_defaults(func=build_image)

    args, unknown = parser.parse_known_args()
    if args.subcommand is None:
        parser.print_help()
    else:
        args.func(args, unknown)