Пример #1
0
        public async Task <BuildResult> CallAsync()
        {
            await pullAndCacheBaseImageLayersStep.GetFuture().ConfigureAwait(false);

            await buildAndCacheApplicationLayersStep.GetFuture().ConfigureAwait(false);

            await buildImageStep.GetFuture().ConfigureAwait(false);

            buildConfiguration
            .GetEventHandlers()
            .Dispatch(LogEvent.Progress(Resources.LoadDockerStepDescription));

            using (progressEventDispatcherFactory.Create(Resources.LoadDockerStepDescription, 1))
            {
                Image image = await buildImageStep.GetFuture().ConfigureAwait(false);

                IImageReference targetImageReference =
                    buildConfiguration.GetTargetImageConfiguration().GetImage();

                // Load the image to docker daemon.
                buildConfiguration
                .GetEventHandlers()
                .Dispatch(
                    LogEvent.Debug(await dockerClient.LoadAsync(new ImageTarball(image, targetImageReference)).ConfigureAwait(false)));

                // Tags the image with all the additional tags, skipping the one 'docker load' already loaded.
                foreach (string tag in buildConfiguration.GetAllTargetImageTags())
                {
                    if (tag.Equals(targetImageReference.GetTag(), StringComparison.Ordinal))
                    {
                        continue;
                    }

                    ImageReference taggedImageReference = targetImageReference.WithTag(tag);
                    await dockerClient.TagAsync(targetImageReference, taggedImageReference).ConfigureAwait(false);
                }

                return(await BuildResult.FromImageAsync(image, buildConfiguration.GetTargetFormat()).ConfigureAwait(false));
            }
        }
Пример #2
0
 public string GetImageTag()
 {
     return(image.GetTag());
 }