Class LayerConfiguration.Builder

    • 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 built LayerConfiguration.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(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 file myfile to the container file system at /path/in/container.

        For example, addEntry(Paths.get("mydirectory"), AbsoluteUnixPath.get("/path/in/container")) adds a directory mydirectory/ to the container file system at /path/in/container/. This does not add the contents of mydirectory.

        Parameters:
        sourceFile - the source file to add to the layer
        pathInContainer - the path in the container file system corresponding to the sourceFile
        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. See addEntry(Path, AbsoluteUnixPath) for more information.
        Parameters:
        sourceFile - the source file to add to the layer
        pathInContainer - the path in the container file system corresponding to the sourceFile
        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. See addEntry(Path, AbsoluteUnixPath) for more information.
        Parameters:
        sourceFile - the source file to add to the layer
        pathInContainer - the path in the container file system corresponding to the sourceFile
        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. See addEntry(Path, AbsoluteUnixPath) for more information.
        Parameters:
        sourceFile - the source file to add to the layer
        pathInContainer - the path in the container file system corresponding to the sourceFile
        permissions - the file permissions on the container
        modificationTime - 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")) adds mydirectory to the container file system at /path/in/container such that mydirectory/subfile is found at /path/in/container/subfile.

        Parameters:
        sourceFile - the source file to add to the layer recursively
        pathInContainer - the path in the container file system corresponding to the sourceFile
        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 recursively
        pathInContainer - the path in the container file system corresponding to the sourceFile
        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 recursively
        pathInContainer - the path in the container file system corresponding to the sourceFile
        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
        modificationTimeProvider - 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