Package com.google.cloud.tools.jib.api
Class LayerConfiguration.Builder
- java.lang.Object
-
- com.google.cloud.tools.jib.api.LayerConfiguration.Builder
-
- Enclosing class:
- LayerConfiguration
public static class LayerConfiguration.Builder extends java.lang.Object
Builds aLayerConfiguration
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LayerConfiguration.Builder
addEntry(LayerEntry entry)
Adds an entry to the layer.LayerConfiguration.Builder
addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer)
Adds an entry to the layer.LayerConfiguration.Builder
addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissions permissions)
Adds an entry to the layer with the given permissions.LayerConfiguration.Builder
addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissions permissions, java.time.Instant modificationTime)
Adds an entry to the layer with the given permissions and file modification time.LayerConfiguration.Builder
addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, java.time.Instant modificationTime)
Adds an entry to the layer with the given file modification time.LayerConfiguration.Builder
addEntryRecursive(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer)
Adds an entry to the layer.LayerConfiguration.Builder
addEntryRecursive(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissionsProvider filePermissionProvider)
Adds an entry to the layer.LayerConfiguration.Builder
addEntryRecursive(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissionsProvider filePermissionProvider, com.google.cloud.tools.jib.api.buildplan.ModificationTimeProvider modificationTimeProvider)
Adds an entry to the layer.LayerConfiguration
build()
Returns the builtLayerConfiguration
.LayerConfiguration.Builder
setEntries(java.util.List<LayerEntry> entries)
Sets entries for the layer.LayerConfiguration.Builder
setName(java.lang.String name)
Sets a name for this layer.
-
-
-
Method Detail
-
setName
public LayerConfiguration.Builder setName(java.lang.String name)
Sets a name for this layer. This name does not affect the contents of the layer.- Parameters:
name
- the name- Returns:
- this
-
setEntries
public LayerConfiguration.Builder setEntries(java.util.List<LayerEntry> entries)
Sets entries for the layer.- Parameters:
entries
- file entries in the layer- Returns:
- this
-
addEntry
public LayerConfiguration.Builder addEntry(LayerEntry entry)
Adds an entry to the layer.- Parameters:
entry
- the layer entry to add- Returns:
- this
-
addEntry
public LayerConfiguration.Builder addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer)
Adds an entry to the layer. Only adds the single source file to the exact path in the container file system.For example,
addEntry(Paths.get("myfile"), AbsoluteUnixPath.get("/path/in/container"))
adds a filemyfile
to the container file system at/path/in/container
.For example,
addEntry(Paths.get("mydirectory"), AbsoluteUnixPath.get("/path/in/container"))
adds a directorymydirectory/
to the container file system at/path/in/container/
. This does not add the contents ofmydirectory
.- Parameters:
sourceFile
- the source file to add to the layerpathInContainer
- the path in the container file system corresponding to thesourceFile
- Returns:
- this
-
addEntry
public LayerConfiguration.Builder addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissions permissions)
Adds an entry to the layer with the given permissions. Only adds the single source file to the exact path in the container file system. SeeaddEntry(Path, AbsoluteUnixPath)
for more information.- Parameters:
sourceFile
- the source file to add to the layerpathInContainer
- the path in the container file system corresponding to thesourceFile
permissions
- the file permissions on the container- Returns:
- this
- See Also:
addEntry(Path, AbsoluteUnixPath)
,FilePermissions.DEFAULT_FILE_PERMISSIONS
,FilePermissions.DEFAULT_FOLDER_PERMISSIONS
-
addEntry
public LayerConfiguration.Builder addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, java.time.Instant modificationTime)
Adds an entry to the layer with the given file modification time. Only adds the single source file to the exact path in the container file system. SeeaddEntry(Path, AbsoluteUnixPath)
for more information.- Parameters:
sourceFile
- the source file to add to the layerpathInContainer
- the path in the container file system corresponding to thesourceFile
modificationTime
- the file modification time- Returns:
- this
- See Also:
addEntry(Path, AbsoluteUnixPath)
-
addEntry
public LayerConfiguration.Builder addEntry(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissions permissions, java.time.Instant modificationTime)
Adds an entry to the layer with the given permissions and file modification time. Only adds the single source file to the exact path in the container file system. SeeaddEntry(Path, AbsoluteUnixPath)
for more information.- Parameters:
sourceFile
- the source file to add to the layerpathInContainer
- the path in the container file system corresponding to thesourceFile
permissions
- the file permissions on the containermodificationTime
- the file modification time- Returns:
- this
- See Also:
addEntry(Path, AbsoluteUnixPath)
,FilePermissions.DEFAULT_FILE_PERMISSIONS
,FilePermissions.DEFAULT_FOLDER_PERMISSIONS
-
addEntryRecursive
public LayerConfiguration.Builder addEntryRecursive(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer) throws java.io.IOException
Adds an entry to the layer. If the source file is a directory, the directory and its contents will be added recursively.For example,
addEntryRecursive(Paths.get("mydirectory", AbsoluteUnixPath.get("/path/in/container"))
addsmydirectory
to the container file system at/path/in/container
such thatmydirectory/subfile
is found at/path/in/container/subfile
.- Parameters:
sourceFile
- the source file to add to the layer recursivelypathInContainer
- the path in the container file system corresponding to thesourceFile
- Returns:
- this
- Throws:
java.io.IOException
- if an exception occurred when recursively listing the directory
-
addEntryRecursive
public LayerConfiguration.Builder addEntryRecursive(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissionsProvider filePermissionProvider) throws java.io.IOException
Adds an entry to the layer. If the source file is a directory, the directory and its contents will be added recursively.- Parameters:
sourceFile
- the source file to add to the layer recursivelypathInContainer
- the path in the container file system corresponding to thesourceFile
filePermissionProvider
- a provider that takes a source path and destination path on the container and returns the file permissions that should be set for that path- Returns:
- this
- Throws:
java.io.IOException
- if an exception occurred when recursively listing the directory
-
addEntryRecursive
public LayerConfiguration.Builder addEntryRecursive(java.nio.file.Path sourceFile, com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath pathInContainer, com.google.cloud.tools.jib.api.buildplan.FilePermissionsProvider filePermissionProvider, com.google.cloud.tools.jib.api.buildplan.ModificationTimeProvider modificationTimeProvider) throws java.io.IOException
Adds an entry to the layer. If the source file is a directory, the directory and its contents will be added recursively.- Parameters:
sourceFile
- the source file to add to the layer recursivelypathInContainer
- the path in the container file system corresponding to thesourceFile
filePermissionProvider
- a provider that takes a source path and destination path on the container and returns the file permissions that should be set for that pathmodificationTimeProvider
- a provider that takes a source path and destination path on the container and returns the file modification time that should be set for that path- Returns:
- this
- Throws:
java.io.IOException
- if an exception occurred when recursively listing the directory
-
build
public LayerConfiguration build()
Returns the builtLayerConfiguration
.- Returns:
- the built
LayerConfiguration
-
-