private void addDirectoryContentsToLayer(
      Map<LayerType, FileEntriesLayer.Builder> layerBuilders,
      LayerType layerType,
      Path sourceRoot,
      Predicate<Path> pathFilter,
      AbsoluteUnixPath basePathInContainer)
      throws IOException {
    if (!layerBuilders.containsKey(layerType)) {
      layerBuilders.put(layerType, FileEntriesLayer.builder());
    }
    FileEntriesLayer.Builder builder = layerBuilders.get(layerType);

    new DirectoryWalker(sourceRoot)
        .filterRoot()
        .filter(path -> Files.isDirectory(path) || pathFilter.test(path))
        .walk(
            path -> {
              AbsoluteUnixPath pathOnContainer =
                  basePathInContainer.resolve(sourceRoot.relativize(path));
              Instant modificationTime = modificationTimeProvider.get(path, pathOnContainer);
              builder.addEntry(path, pathOnContainer, modificationTime);
            });
  }
Returns a new {@link JibContainerBuilder} using the parameters specified on the {@link
JavaContainerBuilder}.

@return a new {@link JibContainerBuilder} using the parameters specified on the {@link
    JavaContainerBuilder}
@throws IOException if building the {@link JibContainerBuilder} fails.
jib-core/src/main/java/com/google/cloud/tools/jib/api/JavaContainerBuilder.java