private Stream convertInstallToRun()

in plugins/docker/base-image/src/main/java/co/elastic/gradle/dockerbase/DockerDaemonActions.java [153:175]


    private Stream<? extends ContainerImageBuildInstruction> convertInstallToRun(ContainerImageBuildInstruction instruction) {
        if (instruction instanceof Install install) {
            final String packagesToInstall = install.getPackages().stream()
                    .filter(p -> !p.contains("__META__"))
                    .collect(Collectors.joining(" "));
            return Stream.of(
                    // Install instructions need to be run with root
                    new SetUser("root"),
                    wrapInstallCommand(
                            buildable,
                            switch (buildable.getOSDistribution().get()) {
                                case UBUNTU, DEBIAN -> "apt-get install -y " + packagesToInstall;
                                case CENTOS -> "yum install --setopt=skip_missing_names_on_install=False -y " +
                                                packagesToInstall;
                                case WOLFI -> "apk add " + packagesToInstall;
                            }
                    ),
                    // And we restore the user after that
                    new SetUser(user)
            );
        }
        return Stream.of(instruction);
    }