@Test
  public void testSteps_forBuildToDockerRegistry()
      throws IOException, InterruptedException, ExecutionException, RegistryException,
          CacheDirectoryCreationException, InvalidImageReferenceException {
    System.setProperty("jib.alwaysCacheBaseImage", "true");
    String imageReference = dockerHost + ":" + "5000/testimage:testtag";
    Path cacheDirectory = temporaryFolder.newFolder().toPath();
    Containerizer containerizer =
        Containerizer.to(RegistryImage.named(imageReference))
            .setBaseImageLayersCache(cacheDirectory)
            .setApplicationLayersCache(cacheDirectory);

    long lastTime = System.nanoTime();
    JibContainer image1 =
        buildImage(
            ImageReference.of("gcr.io", "distroless/java", DISTROLESS_DIGEST),
            containerizer,
            Collections.emptyList());

    progressChecker.checkCompletion();
    progressChecker = new ProgressChecker(); // to reset

    logger.info("Initial build time: " + ((System.nanoTime() - lastTime) / 1_000_000));

    lastTime = System.nanoTime();
    JibContainer image2 =
        buildImage(
            ImageReference.of("gcr.io", "distroless/java", DISTROLESS_DIGEST),
            containerizer,
            Collections.emptyList());

    logger.info("Secondary build time: " + ((System.nanoTime() - lastTime) / 1_000_000));

    Assert.assertEquals(image1, image2);

    localRegistry.pull(imageReference);
    assertDockerInspect(imageReference);
    assertLayerSize(7, imageReference);
    Assert.assertEquals(
        "Hello, world. An argument.\n", new Command("docker", "run", "--rm", imageReference).run());

    String imageReferenceByDigest = dockerHost + ":5000/testimage@" + image1.getDigest();
    localRegistry.pull(imageReferenceByDigest);
    assertDockerInspect(imageReferenceByDigest);
    Assert.assertEquals(
        "Hello, world. An argument.\n",
        new Command("docker", "run", "--rm", imageReferenceByDigest).run());
  }
Lists the files in the {@code resourcePath} resources directory and builds a {@link
FileEntriesLayer} from those files.
jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ContainerizerIntegrationTest.java