use of org.eclipse.jkube.kit.common.KitLogger in project jkube by eclipse.
the class Main method main.
public static void main(String[] args) {
final KitLogger kitLogger = new KitLogger.StdoutLogger();
kitLogger.info("Initiating default JKube configuration and required services...");
kitLogger.info(" - Creating Docker Service Hub");
final DockerServiceHub dockerServiceHub = DockerServiceHub.newInstance(kitLogger);
kitLogger.info(" - Creating Docker Build Service Configuration");
final BuildServiceConfig dockerBuildServiceConfig = BuildServiceConfig.builder().build();
kitLogger.info(" - Creating configuration for JKube");
kitLogger.info(" - Current working directory is: %s", getProjectDir().toFile().toString());
final JKubeConfiguration configuration = JKubeConfiguration.builder().project(JavaProject.builder().baseDirectory(getProjectDir().toFile()).build()).outputDirectory("target").sourceDirectory(getProjectDir().toFile().getAbsolutePath()).build();
JKubeServiceHub.JKubeServiceHubBuilder buildBuilder = JKubeServiceHub.builder().log(kitLogger).configuration(configuration).platformMode(RuntimeMode.KUBERNETES).dockerServiceHub(dockerServiceHub).buildServiceConfig(dockerBuildServiceConfig);
try (JKubeServiceHub jKubeServiceHub = buildBuilder.build()) {
jKubeServiceHub.getBuildService().build(new DynamicDockerfileGenerator(kitLogger, getProjectDir(), IMAGE_NAME).generateImageConfiguration());
final String imageId = jKubeServiceHub.getDockerServiceHub().getDockerAccess().getImageId(IMAGE_NAME);
kitLogger.info("Docker image built successfully (%s)!", imageId);
System.exit(0);
} catch (Exception ex) {
ex.printStackTrace();
kitLogger.error("Error occurred: '%s'", ex.getMessage());
}
}
Aggregations