Directory
class Directory extends AbstractObject implements IdAble, Exportable, Node, Syncer
A directory.
Properties
| $lastQuery | from AbstractObject |
Methods
No description
Converts this directory to a local git repository
Load the directory as a Dagger module source
Creates a synthetic workspace from this directory.
Change the owner of the directory contents recursively.
Return the directory's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.
Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features.
Returns a list of files and directories at the given path.
check if a file or directory exists
Writes the contents of the directory to a path on the host.
Return a snapshot with some paths included or excluded
Search up the directory tree for a file or directory, and return its path. If no match, return null
Returns a list of files and directories that matche the given pattern.
Returns the name of the directory.
Searches for content matching the given regular expression or literal string.
Opens an interactive terminal in new container with this directory mounted inside.
Return a directory with changes from another directory applied to it.
Return a snapshot with a directory added
Retrieves this directory plus the contents of the given files copied to the given path.
Retrieves this directory plus a new directory created at the given path.
Return a snapshot with a new file added
Retrieves this directory with the given Git-compatible patch applied.
Retrieves this directory with the given Git-compatible patch file applied.
Return a snapshot with a symlink
Retrieves this directory with all file/dir timestamps set to the given time.
Return a snapshot with a subdirectory removed
Return a snapshot with a file removed
Return a snapshot with files removed
Details
in
AbstractObject at line 13
__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)
No description
in
AbstractObject at line 19
protected null|array|string|int|float|bool
queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)
No description
at line 19
GitRepository
asGit()
Converts this directory to a local git repository
at line 28
Module
asModule(string|null $sourceRootPath = '.')
Load the directory as a Dagger module source
at line 40
ModuleSource
asModuleSource(string|null $sourceRootPath = '.')
Load the directory as a Dagger module source
at line 52
Workspace
asWorkspace(string|null $cwd = '/')
Creates a synthetic workspace from this directory.
at line 66
Changeset
changes(Directory $from)
Return the difference between this directory and another directory, typically an older snapshot.
The difference is encoded as a changeset, which also tracks removed files, and can be applied to other directories.
at line 76
Directory
chown(string $path, string $owner)
Change the owner of the directory contents recursively.
at line 87
Directory
diff(Directory $other)
Return the difference between this directory and an another directory. The difference is encoded as a directory.
at line 97
string
digest()
Return the directory's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.
at line 106
Directory
directory(string $path)
Retrieves a directory at the given path.
at line 116
Container
dockerBuild(string|null $dockerfile = 'Dockerfile', Platform|null $platform = null, array|null $buildArgs = null, string|null $target = '', array|null $secrets = null, bool|null $noInit = false, Socket|null $ssh = null)
Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features.
at line 153
array
entries(string|null $path = null)
Returns a list of files and directories at the given path.
at line 165
bool
exists(string $path, ExistsType|null $expectedType = null, bool|null $doNotFollowSymlinks = false)
check if a file or directory exists
at line 181
string
export(string $path, bool|null $wipe = false)
Writes the contents of the directory to a path on the host.
at line 194
File
file(string $path)
Retrieve a file at the given path.
at line 204
Directory
filter(array|null $exclude = [], array|null $include = [], bool|null $gitignore = false)
Return a snapshot with some paths included or excluded
at line 222
string
findUp(string $name, string $start)
Search up the directory tree for a file or directory, and return its path. If no match, return null
at line 233
array
glob(string $pattern)
Returns a list of files and directories that matche the given pattern.
at line 243
Id
id()
A unique identifier for this Directory.
at line 252
string
name()
Returns the name of the directory.
at line 263
array
search(string $pattern, array|null $paths = [], array|null $globs = [], bool|null $literal = false, bool|null $multiline = false, bool|null $dotall = false, bool|null $insensitive = false, bool|null $skipIgnored = false, bool|null $skipHidden = false, bool|null $filesOnly = false, int|null $limit = null)
Searches for content matching the given regular expression or literal string.
Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.
at line 314
Stat
stat(string $path, bool|null $doNotFollowSymlinks = false)
Return file status
at line 327
Syncer
sync()
Force evaluation in the engine.
at line 337
Directory
terminal(Container|null $container = null, array|null $cmd = [], bool|null $experimentalPrivilegedNesting = false, bool|null $insecureRootCapabilities = false)
Opens an interactive terminal in new container with this directory mounted inside.
at line 362
Directory
withChanges(Changeset $changes)
Return a directory with changes from another directory applied to it.
at line 372
Directory
withDirectory(string $path, Directory $source, array|null $exclude = [], array|null $include = [], bool|null $gitignore = false, string|null $owner = '', int|null $permissions = null)
Return a snapshot with a directory added
at line 405
Directory
withError(string $err)
Raise an error.
at line 415
Directory
withFile(string $path, File $source, int|null $permissions = null, string|null $owner = '')
Retrieves this directory plus the contents of the given file copied to the given path.
at line 432
Directory
withFiles(string $path, array $sources, int|null $permissions = null)
Retrieves this directory plus the contents of the given files copied to the given path.
at line 446
Directory
withNewDirectory(string $path, int|null $permissions = 420)
Retrieves this directory plus a new directory created at the given path.
at line 459
Directory
withNewFile(string $path, string $contents, int|null $permissions = 420)
Return a snapshot with a new file added
at line 473
Directory
withPatch(string $patch)
Retrieves this directory with the given Git-compatible patch applied.
at line 483
Directory
withPatchFile(File $patch)
Retrieves this directory with the given Git-compatible patch file applied.
at line 493
Directory
withSymlink(string $target, string $linkName)
Return a snapshot with a symlink
at line 504
Directory
withTimestamps(int $timestamp)
Retrieves this directory with all file/dir timestamps set to the given time.
at line 514
Directory
withoutDirectory(string $path)
Return a snapshot with a subdirectory removed
at line 524
Directory
withoutFile(string $path)
Return a snapshot with a file removed
at line 534
Directory
withoutFiles(array $paths)
Return a snapshot with files removed