def build(self, wait_time=60):
    for container in self.start_order:      
      if not self.config['containers'][container]:
        sys.stderr.write("Error: no configuration found for container: " + container + "\n")
        exit(1)

      config = self.config['containers'][container]
      if 'base_image' not in config:
        sys.stderr.write("Error: no base image specified for container: " + container)
        exit(1)

      base = config['base_image']

      self._handleRequire(container, wait_time)
      
      # If count is defined in the config then we're launching multiple instances of the same thing
      # and they'll need to be tagged accordingly. Count only applies on build.
      count = tag_name = 1
      if 'count' in config:
        count = tag_name = config['count']  
      
      while count > 0:      
        name = container
        if tag_name > 1:
          name = name + "__" + str(count)

        self.log.info('Building container: %s using base template %s', name, base)
      
        build = Container(name, copy.deepcopy(config))
        dockerfile = None
        if 'buildspec' in config:
          if 'dockerfile' in config['buildspec']:      
            dockerfile = config['buildspec']['dockerfile']
          if 'url' in config['buildspec']:  
            # TODO: this doesn't do anything yet
            dockerfile_url = config['buildspec']['url']

        build.build(dockerfile)

        self.containers[name] = build
        count = 1 - count
dataset/ETHPy150Open kstaken/dockermix/dockermix/dockermix.py/ContainerMix.build/swapped operands of `-`