| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #!/usr/bin/env python
- import argparse
- import logging
- import sys
- try:
- import brew
- except ImportError as e:
- print str(e)
- print 'Please install the required dependencies first'
- print 'sudo pip install -r requirements.txt'
- sys.exit(1)
- logger = logging.getLogger(__name__)
- logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
- level='INFO')
- if __name__ == '__main__':
- parser = argparse.ArgumentParser('Build the docker standard library')
- parser.add_argument(
- '--push', action='store_true', default=False,
- help='Push generated repositories'
- )
- parser.add_argument(
- '--debug', default=False, action='store_true',
- help='Enable debugging output'
- )
- # parser.add_argument(
- # '--noprefill', default=True, action='store_false',
- # dest='prefill', help='Disable cache prefill'
- # )
- parser.add_argument(
- '-n', metavar='NAMESPACE', default='library',
- help='Comma-separated list of namespaces used for generated'
- ' repositories. Default is library'
- )
- parser.add_argument(
- '--no-namespace', default=False, action='store_true',
- help='In addition to -n, also tag generated images with no'
- ' namespace (ie, "library/busybox" as "busybox")'
- )
- parser.add_argument(
- '-b', metavar='BRANCH', default=brew.DEFAULT_BRANCH,
- help='Branch in the repository where the library definition'
- ' files will be fetched. Default is ' + brew.DEFAULT_BRANCH
- )
- parser.add_argument(
- 'repository', default=brew.DEFAULT_REPOSITORY,
- nargs='?', help='git repository containing the library definition'
- ' files. Default is ' + brew.DEFAULT_REPOSITORY
- )
- # parser.add_argument(
- # '--reg', default=None, help='Registry address to'
- # ' push build results to. Also sets push to true.'
- # )
- parser.add_argument(
- '--targets', default=None, help='Comma-separated list'
- ' of images to build.'
- )
- args = parser.parse_args()
- if args.debug:
- brew.set_loglevel('DEBUG')
- namespaces = args.n.split(',')
- if args.no_namespace:
- namespaces.append('')
- targets = args.targets.split(',')
- sb_library = brew.StackbrewLibrary(args.repository, args.b)
- builder = brew.LocalBuilder(sb_library, namespaces, targets)
- builder.build_repo_list()
- builder.build_all()
- if args.push:
- builder.push_all()
- # summary = brew.build_library(
- # args.repository, args.b, args.n, args.push or args.reg is not None,
- # args.debug, args.prefill, args.reg, args.targets, None, logger
- # )
|