/** * Builds a {@link BuildConfiguration} using this and a {@link Containerizer}. * * @param containerizer the {@link Containerizer} * @param executorService the {@link ExecutorService} to use, overriding the executor in the * {@link Containerizer} * @return the {@link BuildConfiguration} * @throws CacheDirectoryCreationException if a cache directory could not be created * @throws IOException if an I/O exception occurs */ public BuildConfiguration ToBuildConfiguration( IContainerizer containerizer) { containerizer = containerizer ?? throw new ArgumentNullException(nameof(containerizer)); return(buildConfigurationBuilder .SetTargetImageConfiguration(containerizer.GetImageConfiguration()) .SetAdditionalTargetImageTags(containerizer.GetAdditionalTags()) .SetBaseImageLayersCacheDirectory(SystemPath.From(containerizer.GetBaseImageLayersCacheDirectory())) .SetApplicationLayersCacheDirectory(SystemPath.From(containerizer.GetApplicationLayersCacheDirectory())) .SetContainerConfiguration(containerConfigurationBuilder.Build()) .SetLayerConfigurations(layerConfigurations) .SetAllowInsecureRegistries(containerizer.GetAllowInsecureRegistries()) .SetOffline(containerizer.IsOfflineMode()) .SetToolName(containerizer.GetToolName()) .SetEventHandlers(containerizer.BuildEventHandlers()) .Build()); }
/** * Gets a new {@link AbsoluteUnixPath} from a {@link Path}. The {@code path} must be absolute * (indicated by a non-null {@link Path#getRoot}). * * @param path the absolute {@link Path} to convert to an {@link AbsoluteUnixPath}. * @return a new {@link AbsoluteUnixPath} */ public static AbsoluteUnixPath FromPath(SystemPath path) { path = path ?? throw new ArgumentNullException(nameof(path)); if (path.GetRoot() == null) { path = SystemPath.From(Path.GetFullPath(path)); } Preconditions.CheckArgument( path?.GetRoot() != null, "Cannot create AbsoluteUnixPath from non-absolute Path: " + path); ImmutableArray <string> .Builder pathComponents = ImmutableArray.CreateBuilder <string>(); foreach (SystemPath pathComponent in path) { pathComponents.Add(pathComponent.ToString()); } return(new AbsoluteUnixPath(pathComponents.ToImmutable(), path.GetRoot())); }
/** * Sets the directory to use for caching application layers. This cache can be shared between * multiple images. If not set, a temporary directory will be used as the application layers * cache. This directory can be the same directory used for {@link #setBaseImageLayersCache}. * * @param cacheDirectory the cache directory * @return this */ public IContainerizer SetApplicationLayersCache(string cacheDirectory) { applicationLayersCacheDirectory = SystemPath.From(cacheDirectory); return(this); }