def docker_build(opts, config): """ issue a docker build command in the directory specified. Optionally, if a dockerstache template is given, run dockerstache using that template and the build directory as output """ tag = tag_name(config) latest = latest_tag_name(config) helper = BuildOptionHelper(opts, config) templ = helper['template'] path = helper['directory'] if helper['login']: check = _docker_login(helper) if not check: msg = "Unable to perform docker login due to missing cirrus conf entries" LOGGER.error(msg) sys.exit(1) if templ is not None: ds.run(input=templ, output=path, context=helper['context'], defaults=helper['defaults'], extend_context=config.configuration_map()) tags = [latest, tag] if helper['additional_repos']: tags.extend( additional_repo_tags(config, helper['additional_repos'], latest=True)) _docker_build(path, tags, tag_base(config), helper)
def docker_build(opts, config): """ issue a docker build command in the directory specified. Optionally, if a dockerstache template is given, run dockerstache using that template and the build directory as output """ tag = tag_name(config) latest = latest_tag_name(config) helper = BuildOptionHelper(opts, config) templ = helper['template'] path = helper['directory'] if not os.path.exists(path): os.makedirs(path) if opts.local_test: # # local test => override build args # assumes that the container-init stuff has been used local_tar = '/opt/{package}-latest.tar.gz'.format( package=config.package_name() ) LOGGER.info("Local test build will install latest source tarball from dist...") helper['build_arg']['LOCAL_INSTALL'] = local_tar if helper['login']: check = _docker_login(helper) if not check: msg = "Unable to perform docker login due to missing cirrus conf entries" LOGGER.error(msg) sys.exit(1) if templ is not None: ds.run( input=templ, output=path, context=helper['context'], defaults=helper['defaults'], extend_context=config.configuration_map() ) tags = [latest, tag] if helper['additional_repos']: tags.extend( additional_repo_tags( config, helper['additional_repos'], latest=True ) ) _docker_build(path, tags, tag_base(config), helper)
def docker_build(opts, config): """ issue a docker build command in the directory specified. Optionally, if a dockerstache template is given, run dockerstache using that template and the build directory as output """ tag = tag_name(config) latest = latest_tag_name(config) helper = BuildOptionHelper(opts, config) templ = helper['template'] path = helper['directory'] if not os.path.exists(path): os.makedirs(path) if opts.local_test: # # local test => override build args # assumes that the container-init stuff has been used local_tar = '/opt/{package}-latest.tar.gz'.format( package=config.package_name()) LOGGER.info( "Local test build will install latest source tarball from dist...") helper['build_arg']['LOCAL_INSTALL'] = local_tar if helper['login']: check = _docker_login(helper) if not check: msg = "Unable to perform docker login due to missing cirrus conf entries" LOGGER.error(msg) sys.exit(1) if templ is not None: ds.run(input=templ, output=path, context=helper['context'], defaults=helper['defaults'], extend_context=config.configuration_map()) tags = [latest, tag] if helper['additional_repos']: tags.extend( additional_repo_tags(config, helper['additional_repos'], latest=True)) _docker_build(path, tags, tag_base(config), helper)