'Dockerfile' as String based on sratch for placing plugins.
438889
public String generateDockerfileFor(Map<String, File> plugins) throws IOException {
        StringBuilder builder = new StringBuilder();
        builder.append("FROM scratch").append(NL)
                .append("MAINTAINER Kanstantsin Shautsou <kanstantsin.sha@gmail.com>").append(NL)
                .append("COPY ./ /").append(NL)
                .append("VOLUME /usr/share/jenkins/ref").append(NL);

        for (Map.Entry<String, String> entry : generateLabels(plugins).entrySet()) {
            builder.append("LABEL ").append(entry.getKey()).append("=").append(entry.getValue()).append(NL);
        }

//        newClientBuilderForConnector.append("LABEL GENERATION_UUID=").append(UUID.randomUUID()).append(NL);

        return builder.toString();
    }
958079
function findFilesWithPlaceholders(packageDir) {
  const findCommand = buildPlaceholderFindCommand(packageDir);
  return spawnSync(findCommand.binary, findCommand.args).stdout
    .toString()
    .split(/[\n\r]/)
    .filter(String);
}
544321
def is_container_system_config_file(file):
    
    if not file.startswith("/etc/"):
        return False
    return file in [os.path.join("/etc", f.decode()) for f in CONTAINER_ETC_FILE_OVERRIDE]
115253
def _find_plugin_dir(module_type):
    ''''''

    for install_dir in _get_plugin_install_dirs():
        candidate = os.path.join(install_dir, module_type)
        if os.path.isdir(candidate):
            return candidate
    else:
        raise PluginCandidateError(
            'No plugin found for `{}` module in paths:\n{}'.format(
                module_type, '\n'.join(_get_plugin_install_dirs())))
566895
function plugin(opts) {
  opts = objectAssign({
    modulesDirectory: 'dist/node_modules',
    modulesManifestPath: 'dist/require-modules.json',
    dist: true,
    fromDirectory: 'src',
    distDirectory: 'dist'
  }, opts);

  return through.obj(function (file, enc, cb) {
    if (file.isStream()) {
      this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
      return cb();
    }
    if (file.isBuffer()) {
      var modulesDirectory = path.join(process.cwd(), opts.modulesDirectory);
      var modulesManifestPath = path.join(process.cwd(), opts.modulesManifestPath);
      var distDirectory = opts.distDirectory;

      // get old modulesManifest
      if (fs.existsSync(modulesManifestPath)) {
        var data = fs.readFileSync(modulesManifestPath, 'utf8');
        modulesManifest = JSON.parse(data);
      } else {
        dirname = path.dirname(modulesManifestPath);
        fs.mkdirsSync(dirname);
      }

      var filePath = file.path;
      var contents = file.contents.toString();

      // the path where this file will be disted to
      var distFilePath = filePath;
      if (distDirectory) {
        var cwd = path.join(process.cwd());
        var relativePath = path.relative(path.join(cwd, opts.fromDirectory || ''), filePath);
        var distFilePath = path.join(process.cwd(), distDirectory, relativePath);
      }
      var distFileDirname = path.dirname(distFilePath);

      // modules
      var modules = getModules(contents);
      for (var index in modules) {
        var module = modules[index];

        var modulePath = path_util.modulePath(module, node_modules);
        if (modulePath === null) {
          continue;
        }
        var targetPath = path_util.targetPath(modulePath, node_modules, modulesDirectory);

        if (!modulesManifest.hasOwnProperty(module)) {
          var relativePath = path.relative(process.cwd(), targetPath);
          modulesManifest[module] = relativePath;

          if (!fs.existsSync(targetPath)) {
            transformFile(modulePath, targetPath, modulesDirectory);
          }
        }

        if (opts.dist) { // replace modules with path
          var relativePath = path_util.relativePath(distFileDirname, targetPath);
          var re = eval('\/require\\\(\[\'\"\]' + module + '\[\'\"\]\\\)\/ig');
          contents = contents.replace(re, 'require(\'' + relativePath + '\')');
        }
      }

      // subModules
      var subModules = getSubModules(contents);
      for (var index in subModules) {
        var subModule = subModules[index];
        var subModulePath = path_util.subModulePath(subModule, node_modules);
        if (subModulePath === null) {
          continue;
        }
        var targetPath = path_util.targetPath(subModulePath, node_modules, modulesDirectory);

        if (!modulesManifest.hasOwnProperty(subModule)) {
          var relativePath = path.relative(process.cwd(), targetPath);
          modulesManifest[subModule] = relativePath;

          if (!fs.existsSync(targetPath)) {
            transformFile(subModulePath, targetPath, modulesDirectory);
          }
        }

        if (opts.dist) { // replace modules with path
          var relativePath = path_util.relativePath(distFileDirname, targetPath);
          var subModuleRegex = subModule.replace('/', '\\\/');
          var subModuleRegex = subModuleRegex.replace('.', '\\\.');
          var re = 'require\\\(\[\'\"\]' + subModuleRegex + '\[\'\"\]\\\)';
          var regex = new RegExp(re, 'ig');
          contents = contents.replace(regex, 'require(\'' + relativePath + '\')');
        }
      }
      file.contents = Buffer.from(contents);
      fs.writeFileSync(modulesManifestPath, JSON.stringify(modulesManifest, null, 2), 'utf8');
    }

    // go to next gulp plugin
    this.push(file);
    cb();
  });
}
899765
def input_file(self, _container):
        """"""
        p = local.path(_container)
        if set_input_container(p, CFG):
            return

        p = find_hash(CFG["container"]["known"].value, container)
        if set_input_container(p, CFG):
            return

        raise ValueError("The path '{0}' does not exist.".format(p))
151442
function plugin(options){
  options = options || {};
  var keys = options.keys || [];

  return function(files, metalsmith, done){
    setImmediate(done);
    Object.keys(files).forEach(function(file){
      debug('checking file: %s', file);
      if (!isHtml(file)) return;
      var data = files[file];
      var dir = dirname(file);
      var html = basename(file, extname(file)) + '.html';
      if ('.' != dir) html = dir + '/' + html;

      debug('Encoding html entities in file: %s', file);

      var reg = /\`\`\`([\s\S]+?)\`\`\`/gi;
      var rep = function(match, group) {
        if (group) {
          return he.encode(group, {useNamedReferences: true});
        }
        else {
          return "";
        }
      };
      var encoded = data.contents.toString().replace(reg, rep);
      data.contents = new Buffer(encoded);

      keys.forEach(function(key) {
        data[key] = data[key].replace(reg, rep);
      });

      delete files[file];
      files[html] = data;
    });
  };
}
825410
def add_plugin(self, plugin_type, plugin_name, args_dict):
        

        plugin_modified = False

        for plugin in self.dock_json[plugin_type]:
            if plugin['name'] == plugin_name:
                plugin['args'] = args_dict
                plugin_modified = True

        if not plugin_modified:
            self.dock_json[plugin_type].append({"name": plugin_name, "args": args_dict})
856772
def build(image, build_path, tag=None, build_args=None, fromline=None, args=[]):
    

    if tag:
        image = ":".join([image, tag])

    bdir = tempfile.mkdtemp()
    os.system('cp -r {0:s}/* {1:s}'.format(build_path, bdir))
    if build_args:
        stdw = tempfile.NamedTemporaryFile(dir=bdir, mode='w')
        with open("{}/Dockerfile".format(bdir)) as std:
            dfile = std.readlines()

        for line in dfile:
            if fromline and line.lower().startswith('from'):
                stdw.write('FROM {:s}\n'.format(fromline))
            elif line.lower().startswith("cmd"):
                for arg in build_args:
                    stdw.write(arg+"\n")
                stdw.write(line)
            else:
                stdw.write(line)
        stdw.flush()
        utils.xrun("docker build", args+["--force-rm","-f", stdw.name, 
                   "-t", image, 
                    bdir])

        stdw.close()
    else:
        utils.xrun("docker build", args+["--force-rm", "-t", image, 
                    bdir])

    os.system('rm -rf {:s}'.format(bdir))
548560
function getDockerUid(bindPath) {
  const options = [
    'run',
    '--rm',
    '-v',
    `${bindPath}:/test`,
    'alpine',
    'stat',
    '-c',
    '%u',
    '/bin/sh'
  ];
  const ps = dockerCommand(options);
  return ps.stdout.trim();
}
210831
def create_build_context(image, inputs, wdir):
    
    assert os.path.isabs(wdir)

    dockerlines = ["FROM %s" % image,
                    "RUN mkdir -p %s" % wdir]
    build_context = {}

    # This loop creates a Build Context for building the provisioned image
    # We create a tar archive to be added to the root of the image filesystem
    if inputs:
        dockerlines.append('COPY root /')
        for ifile, (path, obj) in enumerate(inputs.items()):
            if not os.path.isabs(path):
                path = os.path.join(wdir, path)
            assert path[0] == '/'
            build_context['root' + path] = obj

    dockerstring = '\n'.join(dockerlines)
    build_context['Dockerfile'] = pyccc.BytesContainer(dockerstring.encode('utf-8'))
    return build_context
425316
function compileBody(str, options){
  var debug_sources = {};
  debug_sources[options.filename] = str;
  var dependencies = [];
  var plugins = options.plugins || [];
  var ast = load.string(str, {
    filename: options.filename,
    basedir: options.basedir,
    lex: function (str, options) {
      var lexOptions = {};
      Object.keys(options).forEach(function (key) {
        lexOptions[key] = options[key];
      });
      lexOptions.plugins = plugins.filter(function (plugin) {
        return !!plugin.lex;
      }).map(function (plugin) {
        return plugin.lex;
      });
      var contents = applyPlugins(str, {filename: options.filename}, plugins, 'preLex');
      return applyPlugins(lex(contents, lexOptions), options, plugins, 'postLex');
    },
    parse: function (tokens, options) {
      tokens = tokens.map(function (token) {
        if (token.type === 'path' && path.extname(token.val) === '') {
          return {
            type: 'path',
            loc: token.loc,
            val: token.val + '.pug'
          };
        }
        return token;
      });
      tokens = stripComments(tokens, options);
      tokens = applyPlugins(tokens, options, plugins, 'preParse');
      var parseOptions = {};
      Object.keys(options).forEach(function (key) {
        parseOptions[key] = options[key];
      });
      parseOptions.plugins = plugins.filter(function (plugin) {
        return !!plugin.parse;
      }).map(function (plugin) {
        return plugin.parse;
      });

      return applyPlugins(
        applyPlugins(parse(tokens, parseOptions), options, plugins, 'postParse'),
        options, plugins, 'preLoad'
      );
    },
    resolve: function (filename, source, loadOptions) {
      var replacementFunc = findReplacementFunc(plugins, 'resolve');
      if (replacementFunc) {
        return replacementFunc(filename, source, options);
      }

      return load.resolve(filename, source, loadOptions);
    },
    read: function (filename, loadOptions) {
      dependencies.push(filename);

      var contents;

      var replacementFunc = findReplacementFunc(plugins, 'read');
      if (replacementFunc) {
        contents = replacementFunc(filename, options);
      } else {
        contents = load.read(filename, loadOptions);
      }

      var str = applyPlugins(contents, {filename: filename}, plugins, 'preLex');
      debug_sources[filename] = str;
      return str;
    }
  });
  ast = applyPlugins(ast, options, plugins, 'postLoad');
  ast = applyPlugins(ast, options, plugins, 'preFilters');

  var filtersSet = {};
  Object.keys(exports.filters).forEach(function (key) {
    filtersSet[key] = exports.filters[key];
  });
  if (options.filters) {
    Object.keys(options.filters).forEach(function (key) {
      filtersSet[key] = options.filters[key];
    });
  }
  ast = filters.handleFilters(ast, filtersSet, options.filterOptions, options.filterAliases);

  ast = applyPlugins(ast, options, plugins, 'postFilters');
  ast = applyPlugins(ast, options, plugins, 'preLink');
  ast = link(ast);
  ast = applyPlugins(ast, options, plugins, 'postLink');

  // Compile
  ast = applyPlugins(ast, options, plugins, 'preCodeGen');
  var js = generateCode(ast, {
    pretty: options.pretty,
    compileDebug: options.compileDebug,
    doctype: options.doctype,
    inlineRuntimeFunctions: options.inlineRuntimeFunctions,
    globals: options.globals,
    self: options.self,
    includeSources: options.includeSources ? debug_sources : false,
    templateName: options.templateName
  });
  js = applyPlugins(js, options, plugins, 'postCodeGen');
  // Debug compiler
  if (options.debug) {
    console.error('\nCompiled Function:\n\n\u001b[90m%s\u001b[0m', js.replace(/^/gm, '  '));
  }

  return {body: js, dependencies: dependencies};
}
764764
function pluginFolder () {
  const path = sketchtoolExec('show plugins');
  invariant(path, 'Plugin folder not found!');
  invariant(fs.existsSync(path), `Plugin folder does not exist at ${path}!`);
  return path;
}
904147
def generate_hosts(config, app):
    '''
    
    '''
#    hosts = {app[container]["NetworkSettings"]["IPAddress"]:app[container]["Name"].replace('/','') for container in app}
    hosts = {}
    for container in app:
        hosts[app[container]["NetworkSettings"]["IPAddress"]] = [app[container]["Name"].replace('/','')]
    for container in app:
        path = (app[container]["HostsPath"]
                if boot2docker.has() is not True
                else os.path.join(config["config_path"],"docker","containers",app[container]["Id"],"hosts"))
        try:
            with open(path, 'r+') as f:
                for host in hosts:
                    f.write("%s\t%s\n"%(host," ".join(hosts[host])))
        except Exception as e:
            utils.error(e)
1346221
void verifyGivenDockerfile(File dockerFile, BuildImageConfiguration buildConfig, FixedStringSearchInterpolator interpolator, Logger log) throws IOException {
        AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration();
        if (assemblyConfig == null) {
            return;
        }

        String name = assemblyConfig.getName();
            for (String keyword : new String[] { "ADD", "COPY" }) {
                List<String[]> lines = DockerFileUtil.extractLines(dockerFile, keyword, interpolator);
                for (String[] line : lines) {
                    if (!line[0].startsWith("#")) {
                        // Skip command flags like --chown
                        int i;
                        for (i = 1; i < line.length; i++) {
                            String component = line[i];
                            if (!component.startsWith("--")) {
                                break;
                            }
                        }

                        // contains an ADD/COPY ... targetDir .... All good.
                        if (i < line.length && line[i].contains(name)) {
                            return;
                        }
                    }
                }
            }
        log.warn("Dockerfile %s does not contain an ADD or COPY directive to include assembly created at %s. Ignoring assembly.",
                 dockerFile.getPath(), name);
    }
258784
function(compose, project, opts) {

    // Start up a collector of files
    var files = [];

    // Check if we are in binary mode or not.
    var isBin = kbox.core.deps.get('globalConfig').isBinary;

    // Export our compose stuff and add to commands
    _.forEach(compose, function(unit) {

      // If we are in binary mode and have internal compose files then we
      // have to read in files and then export them out because
      // docker compose cannot read a file that is in a binary
      if (isBin && opts && opts.internal) {
        if (typeof unit === 'string') {
          var newUnit = kbox.util.yaml.toJson(unit);
          unit = newUnit;
        }
      }

      // Now we can proceed normally. Create files where we need to
      // otherwise use the ones provided
      if (typeof unit === 'object') {

        // Create temp stuff
        var tmpDir = path.join(kbox.util.disk.getTempDir(), project);
        fs.mkdirpSync(tmpDir);

        // Generate a new compose file and add to our thing
        var fileName = [project, _.uniqueId()].join('-') + '.yml';
        var newComposeFile = path.join(tmpDir, fileName);
        kbox.util.yaml.toYamlFile(unit, newComposeFile);
        unit = newComposeFile;

      }

      // Add in our unit
      files.push('--file');
      files.push(unit);

    });

    // Return all the files
    return files;

  }
501218
def register_plugin_dir(path):
    """"""
    import glob
    for f in glob.glob(path + '/*.py'):
        for k, v in load_plugins_from_module(f).items():
            if k:
                global_registry[k] = v