Search in sources :

Example 1 with ImageTarball

use of com.google.cloud.tools.jib.image.ImageTarball in project jib by google.

the class LoadDockerStep method call.

@Override
public BuildResult call() throws InterruptedException, IOException {
    EventHandlers eventHandlers = buildContext.getEventHandlers();
    try (TimerEventDispatcher ignored = new TimerEventDispatcher(eventHandlers, "Loading to Docker daemon")) {
        eventHandlers.dispatch(LogEvent.progress("Loading to Docker daemon..."));
        ImageTarball imageTarball = new ImageTarball(builtImage, buildContext.getTargetImageConfiguration().getImage(), buildContext.getAllTargetImageTags());
        // See https://github.com/GoogleContainerTools/jib/pull/1960#discussion_r321898390
        try (ProgressEventDispatcher progressEventDispatcher = progressEventDispatcherFactory.create("loading to Docker daemon", imageTarball.getTotalLayerSize());
            ThrottledAccumulatingConsumer throttledProgressReporter = new ThrottledAccumulatingConsumer(progressEventDispatcher::dispatchProgress)) {
            // Load the image to docker daemon.
            eventHandlers.dispatch(LogEvent.debug(dockerClient.load(imageTarball, throttledProgressReporter)));
            return BuildResult.fromImage(builtImage, buildContext.getTargetFormat());
        }
    }
}
Also used : ProgressEventDispatcher(com.google.cloud.tools.jib.builder.ProgressEventDispatcher) ImageTarball(com.google.cloud.tools.jib.image.ImageTarball) TimerEventDispatcher(com.google.cloud.tools.jib.builder.TimerEventDispatcher) ThrottledAccumulatingConsumer(com.google.cloud.tools.jib.event.progress.ThrottledAccumulatingConsumer) EventHandlers(com.google.cloud.tools.jib.event.EventHandlers)

Example 2 with ImageTarball

use of com.google.cloud.tools.jib.image.ImageTarball in project jib by GoogleContainerTools.

the class LoadDockerStep method call.

@Override
public BuildResult call() throws InterruptedException, IOException {
    EventHandlers eventHandlers = buildContext.getEventHandlers();
    try (TimerEventDispatcher ignored = new TimerEventDispatcher(eventHandlers, "Loading to Docker daemon")) {
        eventHandlers.dispatch(LogEvent.progress("Loading to Docker daemon..."));
        ImageTarball imageTarball = new ImageTarball(builtImage, buildContext.getTargetImageConfiguration().getImage(), buildContext.getAllTargetImageTags());
        // See https://github.com/GoogleContainerTools/jib/pull/1960#discussion_r321898390
        try (ProgressEventDispatcher progressEventDispatcher = progressEventDispatcherFactory.create("loading to Docker daemon", imageTarball.getTotalLayerSize());
            ThrottledAccumulatingConsumer throttledProgressReporter = new ThrottledAccumulatingConsumer(progressEventDispatcher::dispatchProgress)) {
            // Load the image to docker daemon.
            eventHandlers.dispatch(LogEvent.debug(dockerClient.load(imageTarball, throttledProgressReporter)));
            return BuildResult.fromImage(builtImage, buildContext.getTargetFormat());
        }
    }
}
Also used : ProgressEventDispatcher(com.google.cloud.tools.jib.builder.ProgressEventDispatcher) ImageTarball(com.google.cloud.tools.jib.image.ImageTarball) TimerEventDispatcher(com.google.cloud.tools.jib.builder.TimerEventDispatcher) ThrottledAccumulatingConsumer(com.google.cloud.tools.jib.event.progress.ThrottledAccumulatingConsumer) EventHandlers(com.google.cloud.tools.jib.event.EventHandlers)

Aggregations

ProgressEventDispatcher (com.google.cloud.tools.jib.builder.ProgressEventDispatcher)2 TimerEventDispatcher (com.google.cloud.tools.jib.builder.TimerEventDispatcher)2 EventHandlers (com.google.cloud.tools.jib.event.EventHandlers)2 ThrottledAccumulatingConsumer (com.google.cloud.tools.jib.event.progress.ThrottledAccumulatingConsumer)2 ImageTarball (com.google.cloud.tools.jib.image.ImageTarball)2