private static Blob compress(Blob blob) {
    return Blobs.from(
        outputStream -> {
          try (GZIPOutputStream compressorStream = new GZIPOutputStream(outputStream)) {
            blob.writeTo(compressorStream);
          }
        },
        false);
  }
Gets a {@link Blob} that is {@code blob} compressed. Note that the output stream is closed when
the blob is written.

@param blob the {@link Blob} to compress
@return the compressed {@link Blob}
jib-core/src/test/java/com/google/cloud/tools/jib/cache/CacheTest.java