private static void PushImages() { if (Options.IsPushEnabled) { WriteHeading("PUSHING IMAGES"); if (Options.Username != null) { string loginArgsWithoutPassword = $"login -u {Options.Username} -p"; ExecuteHelper.Execute( "docker", $"{loginArgsWithoutPassword} {Options.Password}", Options.IsDryRun, executeMessageOverride: $"{loginArgsWithoutPassword} ********"); } foreach (string tag in RepoInfo.GetPlatformTags()) { ExecuteHelper.ExecuteWithRetry("docker", $"push {tag}", Options.IsDryRun); } if (Options.Username != null) { ExecuteHelper.Execute("docker", $"logout", Options.IsDryRun); } } }
private static void BuildImages() { WriteHeading("BUILDING IMAGES"); foreach (ImageInfo imageInfo in RepoInfo.Images.Where(image => image.Platform != null)) { Console.WriteLine($"-- BUILDING: {imageInfo.Platform.Model.Dockerfile}"); if (!Options.IsSkipPullingEnabled && imageInfo.Platform.IsExternalFromImage) { // Ensure latest base image exists locally before building ExecuteHelper.ExecuteWithRetry("docker", $"pull {imageInfo.Platform.FromImage}", Options.IsDryRun); } ExecuteHelper.Execute( "docker", $"build -t {string.Join(" -t ", imageInfo.Tags)} {imageInfo.Platform.Model.Dockerfile}", Options.IsDryRun); } }