private JibContainerBuilder prepare()

in arthur-maven-plugin/src/main/java/org/apache/geronimo/arthur/maven/mojo/JibMojo.java [288:357]


    private JibContainerBuilder prepare() {
        try {
            final JibContainerBuilder from = Jib.from(ImageReference.parse(this.from));
            if (ports != null) {
                from.setExposedPorts(Ports.parse(ports));
            }
            if (labels != null) {
                from.setLabels(labels);
            }
            if (programArguments != null) {
                from.setProgramArguments(programArguments);
            }
            from.setCreationTime(creationTimestamp < 0 ? Instant.now() : Instant.ofEpochMilli(creationTimestamp));

            final boolean hasNatives = useLDD || (includeNatives != null && !includeNatives.isEmpty() && !singletonList("false").equals(includeNatives));
            final Path source = ofNullable(binarySource)
                    .map(File::toPath)
                    .orElseGet(() -> Paths.get(requireNonNull(
                            project.getProperties().getProperty(propertiesPrefix + "binary.path"),
                            "No binary path found, ensure to run native-image before or set entrypoint")));

            final Map<String, String> env = environment == null ? new TreeMap<>() : new TreeMap<>(environment);

            final List<FileEntriesLayer> layers = new ArrayList<>(8);
            if (includeCacerts) {
                layers.add(findCertificates());
            }

            String ldLinux = null;
            if (hasNatives) {
                if (!singletonList("false").equals(includeNatives)) {
                    layers.add(findNatives());
                }

                if (useLDD) {
                    ldLinux = addLddLibsAndFindLdLinux(env, layers);
                }
            }

            if (otherFiles != null && !otherFiles.isEmpty()) {
                layers.add(createOthersLayer());
            }
            layers.add(FileEntriesLayer.builder()
                    .setName("Binary")
                    .addEntry(new FileEntry(
                            source, AbsoluteUnixPath.get(entrypoint.iterator().next()), FilePermissions.fromOctalString("755"),
                            getTimestamp(source)))
                    .build());

            from.setFileEntriesLayers(layers);

            if (!env.isEmpty()) {
                from.setEnvironment(env);
            }

            if (entrypoint == null || entrypoint.size() < 1) {
                throw new IllegalArgumentException("No entrypoint set");
            }
            from.setEntrypoint(Stream.concat(Stream.concat(Stream.concat(
                    useLDD && ldLinux != null && !skipLdLinuxInEntrypoint ? Stream.of(ldLinux) : Stream.empty(),
                    entrypoint.stream()),
                    hasNatives ? Stream.of("-Djava.library.path=" + nativeRootDir) : Stream.empty()),
                    includeCacerts ? Stream.of("-Djavax.net.ssl.trustStore=" + cacertsTarget) : Stream.empty())
                    .collect(toList()));

            return from;
        } catch (final InvalidImageReferenceException | IOException e) {
            throw new IllegalStateException(e);
        }
    }