public LayerEntry( SystemPath sourceFile, AbsoluteUnixPath extractionPath, FilePermissions permissions = null, Instant?lastModifiedTime = null) { SourceFile = sourceFile; ExtractionPath = extractionPath; Permissions = permissions ?? LayerConfiguration.DefaultFilePermissionsProvider(SourceFile, ExtractionPath); LastModifiedTime = lastModifiedTime ?? LayerConfiguration.DefaultModifiedTimeProvider(SourceFile, ExtractionPath); }
/** * Adds a new layer to the container with {@code files} as the source files and {@code * pathInContainer} as the path to copy the source files to in the container file system. * * <p>Source files that are directories will be recursively copied. For example, if the source * files are: * * <ul> * <li>{@code fileA} * <li>{@code fileB} * <li>{@code directory/} * </ul> * * and the destination to copy to is {@code /path/in/container}, then the new layer will have the * following entries for the container file system: * * <ul> * <li>{@code /path/in/container/fileA} * <li>{@code /path/in/container/fileB} * <li>{@code /path/in/container/directory/} * <li>{@code /path/in/container/directory/...} (all contents of {@code directory/}) * </ul> * * @param files the source files to copy to a new layer in the container * @param pathInContainer the path in the container file system corresponding to the {@code * sourceFile} * @return this * @throws IOException if an exception occurred when recursively listing any directories */ public FibContainerBuilder AddLayer(IList <SystemPath> files, AbsoluteUnixPath pathInContainer) { pathInContainer = pathInContainer ?? throw new ArgumentNullException(nameof(pathInContainer)); files = files ?? throw new ArgumentNullException(nameof(files)); LayerConfiguration.Builder layerConfigurationBuilder = LayerConfiguration.CreateBuilder(); foreach (SystemPath file in files) { layerConfigurationBuilder.AddEntryRecursive( file, pathInContainer.Resolve(file.GetFileName())); } return(AddLayer(layerConfigurationBuilder.Build())); }