@dagger.io/dagger 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,7 +33,13 @@ declare class BaseClient {
33
33
  get queryTree(): QueryTree[];
34
34
  }
35
35
  export type BuildArg = {
36
+ /**
37
+ * The build argument name.
38
+ */
36
39
  name: string;
40
+ /**
41
+ * The build argument value.
42
+ */
37
43
  value: string;
38
44
  };
39
45
  /**
@@ -63,7 +69,8 @@ export declare enum CacheSharingMode {
63
69
  export type ContainerBuildOpts = {
64
70
  /**
65
71
  * Path to the Dockerfile to use.
66
- * Defaults to './Dockerfile'.
72
+ *
73
+ * Default: './Dockerfile'.
67
74
  */
68
75
  dockerfile?: string;
69
76
  /**
@@ -75,21 +82,31 @@ export type ContainerBuildOpts = {
75
82
  */
76
83
  target?: string;
77
84
  };
85
+ export type ContainerEndpointOpts = {
86
+ /**
87
+ * The exposed port number for the endpoint
88
+ */
89
+ port?: number;
90
+ /**
91
+ * Return a URL with the given scheme, eg. http for http://
92
+ */
93
+ scheme?: string;
94
+ };
78
95
  export type ContainerExecOpts = {
79
96
  /**
80
- * Command to run instead of the container's default command.
97
+ * Command to run instead of the container's default command (e.g., ["run", "main.go"]).
81
98
  */
82
99
  args?: string[];
83
100
  /**
84
- * Content to write to the command's standard input before closing.
101
+ * Content to write to the command's standard input before closing (e.g., "Hello world").
85
102
  */
86
103
  stdin?: string;
87
104
  /**
88
- * Redirect the command's standard output to a file in the container.
105
+ * Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
89
106
  */
90
107
  redirectStdout?: string;
91
108
  /**
92
- * Redirect the command's standard error to a file in the container.
109
+ * Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
93
110
  */
94
111
  redirectStderr?: string;
95
112
  /**
@@ -117,38 +134,63 @@ export type ContainerPublishOpts = {
117
134
  platformVariants?: Container[];
118
135
  };
119
136
  export type ContainerWithDefaultArgsOpts = {
137
+ /**
138
+ * Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
139
+ */
120
140
  args?: string[];
121
141
  };
122
142
  export type ContainerWithDirectoryOpts = {
143
+ /**
144
+ * Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
145
+ */
123
146
  exclude?: string[];
147
+ /**
148
+ * Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
149
+ */
124
150
  include?: string[];
125
151
  };
126
152
  export type ContainerWithExecOpts = {
127
153
  /**
128
- * Content to write to the command's standard input before closing.
154
+ * Content to write to the command's standard input before closing (e.g., "Hello world").
129
155
  */
130
156
  stdin?: string;
131
157
  /**
132
- * Redirect the command's standard output to a file in the container.
158
+ * Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
133
159
  */
134
160
  redirectStdout?: string;
135
161
  /**
136
- * Redirect the command's standard error to a file in the container.
162
+ * Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
137
163
  */
138
164
  redirectStderr?: string;
139
165
  /**
140
- * Provide dagger access to the executed command.
166
+ * Provides dagger access to the executed command.
167
+ *
141
168
  * Do not use this option unless you trust the command being executed.
142
169
  * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
143
170
  */
144
171
  experimentalPrivilegedNesting?: boolean;
145
172
  };
173
+ export type ContainerWithExposedPortOpts = {
174
+ /**
175
+ * Transport layer network protocol
176
+ */
177
+ protocol?: NetworkProtocol;
178
+ /**
179
+ * Optional port description
180
+ */
181
+ description?: string;
182
+ };
146
183
  export type ContainerWithFileOpts = {
184
+ /**
185
+ * Permission given to the copied file (e.g., 0600).
186
+ *
187
+ * Default: 0644.
188
+ */
147
189
  permissions?: number;
148
190
  };
149
191
  export type ContainerWithMountedCacheOpts = {
150
192
  /**
151
- * Directory to use as the cache volume's root.
193
+ * Identifier of the directory to use as the cache volume's root.
152
194
  */
153
195
  source?: Directory;
154
196
  /**
@@ -157,9 +199,23 @@ export type ContainerWithMountedCacheOpts = {
157
199
  sharing?: CacheSharingMode;
158
200
  };
159
201
  export type ContainerWithNewFileOpts = {
202
+ /**
203
+ * Content of the file to write (e.g., "Hello world!").
204
+ */
160
205
  contents?: string;
206
+ /**
207
+ * Permission given to the written file (e.g., 0600).
208
+ *
209
+ * Default: 0644.
210
+ */
161
211
  permissions?: number;
162
212
  };
213
+ export type ContainerWithoutExposedPortOpts = {
214
+ /**
215
+ * Port protocol to unexpose
216
+ */
217
+ protocol?: NetworkProtocol;
218
+ };
163
219
  /**
164
220
  * A unique container identifier. Null designates an empty container (scratch).
165
221
  */
@@ -174,8 +230,9 @@ export type DateTime = string & {
174
230
  };
175
231
  export type DirectoryDockerBuildOpts = {
176
232
  /**
177
- * Path to the Dockerfile to use.
178
- * Defaults to './Dockerfile'.
233
+ * Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
234
+ *
235
+ * Defaults: './Dockerfile'.
179
236
  */
180
237
  dockerfile?: string;
181
238
  /**
@@ -183,7 +240,7 @@ export type DirectoryDockerBuildOpts = {
183
240
  */
184
241
  platform?: Platform;
185
242
  /**
186
- * Additional build arguments.
243
+ * Build arguments to use in the build.
187
244
  */
188
245
  buildArgs?: BuildArg[];
189
246
  /**
@@ -192,6 +249,9 @@ export type DirectoryDockerBuildOpts = {
192
249
  target?: string;
193
250
  };
194
251
  export type DirectoryEntriesOpts = {
252
+ /**
253
+ * Location of the directory to look at (e.g., "/src").
254
+ */
195
255
  path?: string;
196
256
  };
197
257
  export type DirectoryPipelineOpts = {
@@ -199,23 +259,36 @@ export type DirectoryPipelineOpts = {
199
259
  };
200
260
  export type DirectoryWithDirectoryOpts = {
201
261
  /**
202
- * Exclude artifacts that match the given pattern.
203
- * (e.g. ["node_modules/", ".git*"]).
262
+ * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
204
263
  */
205
264
  exclude?: string[];
206
265
  /**
207
- * Include only artifacts that match the given pattern.
208
- * (e.g. ["app/", "package.*"]).
266
+ * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
209
267
  */
210
268
  include?: string[];
211
269
  };
212
270
  export type DirectoryWithFileOpts = {
271
+ /**
272
+ * Permission given to the copied file (e.g., 0600).
273
+ *
274
+ * Default: 0644.
275
+ */
213
276
  permissions?: number;
214
277
  };
215
278
  export type DirectoryWithNewDirectoryOpts = {
279
+ /**
280
+ * Permission granted to the created directory (e.g., 0777).
281
+ *
282
+ * Default: 0755.
283
+ */
216
284
  permissions?: number;
217
285
  };
218
286
  export type DirectoryWithNewFileOpts = {
287
+ /**
288
+ * Permission given to the copied file (e.g., 0600).
289
+ *
290
+ * Default: 0644.
291
+ */
219
292
  permissions?: number;
220
293
  };
221
294
  /**
@@ -235,11 +308,23 @@ export type GitRefTreeOpts = {
235
308
  sshAuthSocket?: Socket;
236
309
  };
237
310
  export type HostDirectoryOpts = {
311
+ /**
312
+ * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
313
+ */
238
314
  exclude?: string[];
315
+ /**
316
+ * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
317
+ */
239
318
  include?: string[];
240
319
  };
241
320
  export type HostWorkdirOpts = {
321
+ /**
322
+ * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
323
+ */
242
324
  exclude?: string[];
325
+ /**
326
+ * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
327
+ */
243
328
  include?: string[];
244
329
  };
245
330
  /**
@@ -248,9 +333,23 @@ export type HostWorkdirOpts = {
248
333
  export type ID = string & {
249
334
  __ID: never;
250
335
  };
336
+ /**
337
+ * Transport layer network protocol associated to a port.
338
+ */
339
+ export declare enum NetworkProtocol {
340
+ /**
341
+ * TCP (Transmission Control Protocol)
342
+ */
343
+ Tcp = 0,
344
+ /**
345
+ * UDP (User Datagram Protocol)
346
+ */
347
+ Udp = 1
348
+ }
251
349
  /**
252
350
  * The platform config OS and architecture in a Container.
253
- * The format is [os]/[platform]/[version] (e.g. darwin/arm64/v7, windows/amd64, linux/arm64).
351
+ *
352
+ * The format is [os]/[platform]/[version] (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64").
254
353
  */
255
354
  export type Platform = string & {
256
355
  __Platform: never;
@@ -263,7 +362,20 @@ export type ClientDirectoryOpts = {
263
362
  id?: DirectoryID;
264
363
  };
265
364
  export type ClientGitOpts = {
365
+ /**
366
+ * Set to true to keep .git directory.
367
+ */
266
368
  keepGitDir?: boolean;
369
+ /**
370
+ * A service which must be started before the repo is fetched.
371
+ */
372
+ experimentalServiceHost?: Container;
373
+ };
374
+ export type ClientHttpOpts = {
375
+ /**
376
+ * A service which must be started before the URL is fetched.
377
+ */
378
+ experimentalServiceHost?: Container;
267
379
  };
268
380
  export type ClientPipelineOpts = {
269
381
  description?: string;
@@ -322,10 +434,11 @@ export declare class CacheVolume extends BaseClient {
322
434
  */
323
435
  export declare class Container extends BaseClient {
324
436
  /**
325
- * Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
437
+ * Initializes this container from a Dockerfile build.
326
438
  * @param context Directory context used by the Dockerfile.
327
439
  * @param opts.dockerfile Path to the Dockerfile to use.
328
- Defaults to './Dockerfile'.
440
+ *
441
+ * Default: './Dockerfile'.
329
442
  * @param opts.buildArgs Additional build arguments.
330
443
  * @param opts.target Target build stage to build.
331
444
  */
@@ -335,15 +448,29 @@ export declare class Container extends BaseClient {
335
448
  */
336
449
  defaultArgs(): Promise<string[]>;
337
450
  /**
338
- * Retrieves a directory at the given path. Mounts are included.
451
+ * Retrieves a directory at the given path.
452
+ *
453
+ * Mounts are included.
454
+ * @param path The path of the directory to retrieve (e.g., "./src").
339
455
  */
340
456
  directory(path: string): Directory;
457
+ /**
458
+ * Retrieves an endpoint that clients can use to reach this container.
459
+ *
460
+ * If no port is specified, the first exposed port is used. If none exist an error is returned.
461
+ *
462
+ * If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
463
+ * @param opts.port The exposed port number for the endpoint
464
+ * @param opts.scheme Return a URL with the given scheme, eg. http for http://
465
+ */
466
+ endpoint(opts?: ContainerEndpointOpts): Promise<string>;
341
467
  /**
342
468
  * Retrieves entrypoint to be prepended to the arguments of all commands.
343
469
  */
344
470
  entrypoint(): Promise<string[]>;
345
471
  /**
346
472
  * Retrieves the value of the specified environment variable.
473
+ * @param name The name of the environment variable to retrieve (e.g., "PATH").
347
474
  */
348
475
  envVariable(name: string): Promise<string>;
349
476
  /**
@@ -352,13 +479,13 @@ export declare class Container extends BaseClient {
352
479
  envVariables(): Promise<EnvVariable[]>;
353
480
  /**
354
481
  * Retrieves this container after executing the specified command inside it.
355
- * @param opts.args Command to run instead of the container's default command.
356
- * @param opts.stdin Content to write to the command's standard input before closing.
357
- * @param opts.redirectStdout Redirect the command's standard output to a file in the container.
358
- * @param opts.redirectStderr Redirect the command's standard error to a file in the container.
482
+ * @param opts.args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
483
+ * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
484
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
485
+ * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
359
486
  * @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
360
- Do not use this option unless you trust the command being executed.
361
- The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
487
+ * Do not use this option unless you trust the command being executed.
488
+ * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
362
489
  * @deprecated Replaced by withExec.
363
490
  */
364
491
  exec(opts?: ContainerExecOpts): Container;
@@ -368,22 +495,32 @@ export declare class Container extends BaseClient {
368
495
  */
369
496
  exitCode(): Promise<number>;
370
497
  /**
371
- * Writes the container as an OCI tarball to the destination file path on the host for the specified platformVariants.
498
+ * Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.
499
+ *
372
500
  * Return true on success.
373
- * @param path Host's destination path.
374
- Path can be relative to the engine's workdir or absolute.
501
+ * It can also publishes platform variants.
502
+ * @param path Host's destination path (e.g., "./tarball").
503
+ * Path can be relative to the engine's workdir or absolute.
375
504
  * @param opts.platformVariants Identifiers for other platform specific containers.
376
- Used for multi-platform image.
505
+ * Used for multi-platform image.
377
506
  */
378
507
  export(path: string, opts?: ContainerExportOpts): Promise<boolean>;
379
508
  /**
380
- * Retrieves a file at the given path. Mounts are included.
509
+ * Retrieves the list of exposed ports
510
+ */
511
+ exposedPorts(): Promise<Port[]>;
512
+ /**
513
+ * Retrieves a file at the given path.
514
+ *
515
+ * Mounts are included.
516
+ * @param path The path of the file to retrieve (e.g., "./README.md").
381
517
  */
382
518
  file(path: string): File;
383
519
  /**
384
- * Initializes this container from the base image published at the given address.
520
+ * Initializes this container from a pulled base image.
385
521
  * @param address Image's address from its registry.
386
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
522
+ *
523
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
387
524
  */
388
525
  from(address: string): Container;
389
526
  /**
@@ -391,10 +528,18 @@ export declare class Container extends BaseClient {
391
528
  * @deprecated Replaced by rootfs.
392
529
  */
393
530
  fs(): Directory;
531
+ /**
532
+ * Retrieves a hostname which can be used by clients to reach this container.
533
+ */
534
+ hostname(): Promise<string>;
394
535
  /**
395
536
  * A unique identifier for this container.
396
537
  */
397
538
  id(): Promise<ContainerID>;
539
+ /**
540
+ * The unique image reference which can only be retrieved immediately after the 'Container.From' call.
541
+ */
542
+ imageRef(): Promise<string>;
398
543
  /**
399
544
  * Retrieves the value of the specified label.
400
545
  */
@@ -416,11 +561,15 @@ export declare class Container extends BaseClient {
416
561
  */
417
562
  platform(): Promise<Platform>;
418
563
  /**
419
- * Publishes this container as a new image to the specified address, for the platformVariants, returning a fully qualified ref.
564
+ * Publishes this container as a new image to the specified address.
565
+ *
566
+ * Publish returns a fully qualified ref.
567
+ * It can also publish platform variants.
420
568
  * @param address Registry's address to publish the image to.
421
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
569
+ *
570
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
422
571
  * @param opts.platformVariants Identifiers for other platform specific containers.
423
- Used for multi-platform image.
572
+ * Used for multi-platform image.
424
573
  */
425
574
  publish(address: string, opts?: ContainerPublishOpts): Promise<string>;
426
575
  /**
@@ -443,31 +592,50 @@ export declare class Container extends BaseClient {
443
592
  user(): Promise<string>;
444
593
  /**
445
594
  * Configures default arguments for future commands.
595
+ * @param opts.args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
446
596
  */
447
597
  withDefaultArgs(opts?: ContainerWithDefaultArgsOpts): Container;
448
598
  /**
449
599
  * Retrieves this container plus a directory written at the given path.
600
+ * @param path Location of the written directory (e.g., "/tmp/directory").
601
+ * @param directory Identifier of the directory to write
602
+ * @param opts.exclude Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
603
+ * @param opts.include Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
450
604
  */
451
605
  withDirectory(path: string, directory: Directory, opts?: ContainerWithDirectoryOpts): Container;
452
606
  /**
453
607
  * Retrieves this container but with a different command entrypoint.
608
+ * @param args Entrypoint to use for future executions (e.g., ["go", "run"]).
454
609
  */
455
610
  withEntrypoint(args: string[]): Container;
456
611
  /**
457
612
  * Retrieves this container plus the given environment variable.
613
+ * @param name The name of the environment variable (e.g., "HOST").
614
+ * @param value The value of the environment variable. (e.g., "localhost").
458
615
  */
459
616
  withEnvVariable(name: string, value: string): Container;
460
617
  /**
461
618
  * Retrieves this container after executing the specified command inside it.
462
- * @param args Command to run instead of the container's default command.
463
- * @param opts.stdin Content to write to the command's standard input before closing.
464
- * @param opts.redirectStdout Redirect the command's standard output to a file in the container.
465
- * @param opts.redirectStderr Redirect the command's standard error to a file in the container.
466
- * @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
467
- Do not use this option unless you trust the command being executed.
468
- The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
619
+ * @param args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
620
+ * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
621
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
622
+ * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
623
+ * @param opts.experimentalPrivilegedNesting Provides dagger access to the executed command.
624
+ *
625
+ * Do not use this option unless you trust the command being executed.
626
+ * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
469
627
  */
470
628
  withExec(args: string[], opts?: ContainerWithExecOpts): Container;
629
+ /**
630
+ * Expose a network port.
631
+ * Exposed ports serve two purposes:
632
+ * - For health checks and introspection, when running services
633
+ * - For setting the EXPOSE OCI field when publishing the container
634
+ * @param port Port number to expose
635
+ * @param opts.protocol Transport layer network protocol
636
+ * @param opts.description Optional port description
637
+ */
638
+ withExposedPort(port: number, opts?: ContainerWithExposedPortOpts): Container;
471
639
  /**
472
640
  * Initializes this container from this DirectoryID.
473
641
  * @deprecated Replaced by withRootfs.
@@ -475,44 +643,63 @@ export declare class Container extends BaseClient {
475
643
  withFS(id: Directory): Container;
476
644
  /**
477
645
  * Retrieves this container plus the contents of the given file copied to the given path.
646
+ * @param path Location of the copied file (e.g., "/tmp/file.txt").
647
+ * @param source Identifier of the file to copy.
648
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
649
+ *
650
+ * Default: 0644.
478
651
  */
479
652
  withFile(path: string, source: File, opts?: ContainerWithFileOpts): Container;
480
653
  /**
481
654
  * Retrieves this container plus the given label.
655
+ * @param name The name of the label (e.g., "org.opencontainers.artifact.created").
656
+ * @param value The value of the label (e.g., "2023-01-01T00:00:00Z").
482
657
  */
483
658
  withLabel(name: string, value: string): Container;
484
659
  /**
485
660
  * Retrieves this container plus a cache volume mounted at the given path.
486
- * @param path Path to mount the cache volume at.
487
- * @param cache ID of the cache to mount.
488
- * @param opts.source Directory to use as the cache volume's root.
661
+ * @param path Location of the cache directory (e.g., "/cache/node_modules").
662
+ * @param cache Identifier of the cache volume to mount.
663
+ * @param opts.source Identifier of the directory to use as the cache volume's root.
489
664
  * @param opts.sharing Sharing mode of the cache volume.
490
665
  */
491
666
  withMountedCache(path: string, cache: CacheVolume, opts?: ContainerWithMountedCacheOpts): Container;
492
667
  /**
493
668
  * Retrieves this container plus a directory mounted at the given path.
669
+ * @param path Location of the mounted directory (e.g., "/mnt/directory").
670
+ * @param source Identifier of the mounted directory.
494
671
  */
495
672
  withMountedDirectory(path: string, source: Directory): Container;
496
673
  /**
497
674
  * Retrieves this container plus a file mounted at the given path.
675
+ * @param path Location of the mounted file (e.g., "/tmp/file.txt").
676
+ * @param source Identifier of the mounted file.
498
677
  */
499
678
  withMountedFile(path: string, source: File): Container;
500
679
  /**
501
680
  * Retrieves this container plus a secret mounted into a file at the given path.
681
+ * @param path Location of the secret file (e.g., "/tmp/secret.txt").
682
+ * @param source Identifier of the secret to mount.
502
683
  */
503
684
  withMountedSecret(path: string, source: Secret): Container;
504
685
  /**
505
686
  * Retrieves this container plus a temporary directory mounted at the given path.
687
+ * @param path Location of the temporary directory (e.g., "/tmp/temp_dir").
506
688
  */
507
689
  withMountedTemp(path: string): Container;
508
690
  /**
509
691
  * Retrieves this container plus a new file written at the given path.
692
+ * @param path Location of the written file (e.g., "/tmp/file.txt").
693
+ * @param opts.contents Content of the file to write (e.g., "Hello world!").
694
+ * @param opts.permissions Permission given to the written file (e.g., 0600).
695
+ *
696
+ * Default: 0644.
510
697
  */
511
698
  withNewFile(path: string, opts?: ContainerWithNewFileOpts): Container;
512
699
  /**
513
700
  * Retrieves this container with a registry authentication for a given address.
514
701
  * @param address Registry's address to bind the authentication to.
515
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
702
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
516
703
  * @param username The username of the registry's account (e.g., "Dagger").
517
704
  * @param secret The API key, password or token to authenticate to this registry.
518
705
  */
@@ -523,40 +710,66 @@ export declare class Container extends BaseClient {
523
710
  withRootfs(id: Directory): Container;
524
711
  /**
525
712
  * Retrieves this container plus an env variable containing the given secret.
713
+ * @param name The name of the secret variable (e.g., "API_SECRET").
714
+ * @param secret The identifier of the secret value.
526
715
  */
527
716
  withSecretVariable(name: string, secret: Secret): Container;
717
+ /**
718
+ * Establish a runtime dependency on a service. The service will be started automatically when needed and detached when it is no longer needed.
719
+ *
720
+ * The service will be reachable from the container via the provided hostname alias.
721
+ *
722
+ * The service dependency will also convey to any files or directories produced by the container.
723
+ * @param alias A name that can be used to reach the service from the container
724
+ * @param service Identifier of the service container
725
+ */
726
+ withServiceBinding(alias: string, service: Container): Container;
528
727
  /**
529
728
  * Retrieves this container plus a socket forwarded to the given Unix socket path.
729
+ * @param path Location of the forwarded Unix socket (e.g., "/tmp/socket").
730
+ * @param source Identifier of the socket to forward.
530
731
  */
531
732
  withUnixSocket(path: string, source: Socket): Container;
532
733
  /**
533
- * Retrieves this containers with a different command user.
734
+ * Retrieves this container with a different command user.
735
+ * @param name The user to set (e.g., "root").
534
736
  */
535
737
  withUser(name: string): Container;
536
738
  /**
537
739
  * Retrieves this container with a different working directory.
740
+ * @param path The path to set as the working directory (e.g., "/app").
538
741
  */
539
742
  withWorkdir(path: string): Container;
540
743
  /**
541
744
  * Retrieves this container minus the given environment variable.
745
+ * @param name The name of the environment variable (e.g., "HOST").
542
746
  */
543
747
  withoutEnvVariable(name: string): Container;
748
+ /**
749
+ * Unexpose a previously exposed port.
750
+ * @param port Port number to unexpose
751
+ * @param opts.protocol Port protocol to unexpose
752
+ */
753
+ withoutExposedPort(port: number, opts?: ContainerWithoutExposedPortOpts): Container;
544
754
  /**
545
755
  * Retrieves this container minus the given environment label.
756
+ * @param name The name of the label to remove (e.g., "org.opencontainers.artifact.created").
546
757
  */
547
758
  withoutLabel(name: string): Container;
548
759
  /**
549
760
  * Retrieves this container after unmounting everything at the given path.
761
+ * @param path Location of the cache directory (e.g., "/cache/node_modules").
550
762
  */
551
763
  withoutMount(path: string): Container;
552
764
  /**
553
765
  * Retrieves this container without the registry authentication of a given address.
554
766
  * @param address Registry's address to remove the authentication from.
555
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
767
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
556
768
  */
557
769
  withoutRegistryAuth(address: string): Container;
558
770
  /**
559
771
  * Retrieves this container with a previously added Unix socket removed.
772
+ * @param path Location of the socket to remove (e.g., "/tmp/socket").
560
773
  */
561
774
  withoutUnixSocket(path: string): Container;
562
775
  /**
@@ -592,31 +805,37 @@ export declare class Container extends BaseClient {
592
805
  export declare class Directory extends BaseClient {
593
806
  /**
594
807
  * Gets the difference between this directory and an another directory.
808
+ * @param other Identifier of the directory to compare.
595
809
  */
596
810
  diff(other: Directory): Directory;
597
811
  /**
598
812
  * Retrieves a directory at the given path.
813
+ * @param path Location of the directory to retrieve (e.g., "/src").
599
814
  */
600
815
  directory(path: string): Directory;
601
816
  /**
602
817
  * Builds a new Docker container from this directory.
603
- * @param opts.dockerfile Path to the Dockerfile to use.
604
- Defaults to './Dockerfile'.
818
+ * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
819
+ *
820
+ * Defaults: './Dockerfile'.
605
821
  * @param opts.platform The platform to build.
606
- * @param opts.buildArgs Additional build arguments.
822
+ * @param opts.buildArgs Build arguments to use in the build.
607
823
  * @param opts.target Target build stage to build.
608
824
  */
609
825
  dockerBuild(opts?: DirectoryDockerBuildOpts): Container;
610
826
  /**
611
827
  * Returns a list of files and directories at the given path.
828
+ * @param opts.path Location of the directory to look at (e.g., "/src").
612
829
  */
613
830
  entries(opts?: DirectoryEntriesOpts): Promise<string[]>;
614
831
  /**
615
832
  * Writes the contents of the directory to a path on the host.
833
+ * @param path Location of the copied directory (e.g., "logs/").
616
834
  */
617
835
  export(path: string): Promise<boolean>;
618
836
  /**
619
837
  * Retrieves a file at the given path.
838
+ * @param path Location of the file to retrieve (e.g., "README.md").
620
839
  */
621
840
  file(path: string): File;
622
841
  /**
@@ -633,34 +852,53 @@ export declare class Directory extends BaseClient {
633
852
  pipeline(name: string, opts?: DirectoryPipelineOpts): Directory;
634
853
  /**
635
854
  * Retrieves this directory plus a directory written at the given path.
636
- * @param opts.exclude Exclude artifacts that match the given pattern.
637
- (e.g. ["node_modules/", ".git*"]).
638
- * @param opts.include Include only artifacts that match the given pattern.
639
- (e.g. ["app/", "package.*"]).
855
+ * @param path Location of the written directory (e.g., "/src/").
856
+ * @param directory Identifier of the directory to copy.
857
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
858
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
640
859
  */
641
860
  withDirectory(path: string, directory: Directory, opts?: DirectoryWithDirectoryOpts): Directory;
642
861
  /**
643
862
  * Retrieves this directory plus the contents of the given file copied to the given path.
863
+ * @param path Location of the copied file (e.g., "/file.txt").
864
+ * @param source Identifier of the file to copy.
865
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
866
+ *
867
+ * Default: 0644.
644
868
  */
645
869
  withFile(path: string, source: File, opts?: DirectoryWithFileOpts): Directory;
646
870
  /**
647
871
  * Retrieves this directory plus a new directory created at the given path.
872
+ * @param path Location of the directory created (e.g., "/logs").
873
+ * @param opts.permissions Permission granted to the created directory (e.g., 0777).
874
+ *
875
+ * Default: 0755.
648
876
  */
649
877
  withNewDirectory(path: string, opts?: DirectoryWithNewDirectoryOpts): Directory;
650
878
  /**
651
879
  * Retrieves this directory plus a new file written at the given path.
880
+ * @param path Location of the written file (e.g., "/file.txt").
881
+ * @param contents Content of the written file (e.g., "Hello world!").
882
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
883
+ *
884
+ * Default: 0644.
652
885
  */
653
886
  withNewFile(path: string, contents: string, opts?: DirectoryWithNewFileOpts): Directory;
654
887
  /**
655
- * Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
888
+ * Retrieves this directory with all file/dir timestamps set to the given time.
889
+ * @param timestamp Timestamp to set dir/files in.
890
+ *
891
+ * Formatted in seconds following Unix epoch (e.g., 1672531199).
656
892
  */
657
893
  withTimestamps(timestamp: number): Directory;
658
894
  /**
659
895
  * Retrieves this directory with the directory at the given path removed.
896
+ * @param path Location of the directory to remove (e.g., ".github/").
660
897
  */
661
898
  withoutDirectory(path: string): Directory;
662
899
  /**
663
900
  * Retrieves this directory with the file at the given path removed.
901
+ * @param path Location of the file to remove (e.g., "/file.txt").
664
902
  */
665
903
  withoutFile(path: string): Directory;
666
904
  /**
@@ -731,6 +969,7 @@ export declare class File extends BaseClient {
731
969
  contents(): Promise<string>;
732
970
  /**
733
971
  * Writes the file to a file path on the host.
972
+ * @param path Location of the written directory (e.g., "output.txt").
734
973
  */
735
974
  export(path: string): Promise<boolean>;
736
975
  /**
@@ -746,7 +985,10 @@ export declare class File extends BaseClient {
746
985
  */
747
986
  size(): Promise<number>;
748
987
  /**
749
- * Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
988
+ * Retrieves this file with its created/modified timestamps set to the given time.
989
+ * @param timestamp Timestamp to set dir/files in.
990
+ *
991
+ * Formatted in seconds following Unix epoch (e.g., 1672531199).
750
992
  */
751
993
  withTimestamps(timestamp: number): File;
752
994
  /**
@@ -813,6 +1055,7 @@ export declare class GitRef extends BaseClient {
813
1055
  export declare class GitRepository extends BaseClient {
814
1056
  /**
815
1057
  * Returns details on one branch.
1058
+ * @param name Branch's name (e.g., "main").
816
1059
  */
817
1060
  branch(name: string): GitRef;
818
1061
  /**
@@ -821,10 +1064,12 @@ export declare class GitRepository extends BaseClient {
821
1064
  branches(): Promise<string[]>;
822
1065
  /**
823
1066
  * Returns details on one commit.
1067
+ * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
824
1068
  */
825
1069
  commit(id: string): GitRef;
826
1070
  /**
827
1071
  * Returns details on one tag.
1072
+ * @param name Tag's name (e.g., "v0.3.9").
828
1073
  */
829
1074
  tag(name: string): GitRef;
830
1075
  /**
@@ -860,18 +1105,25 @@ export declare class GitRepository extends BaseClient {
860
1105
  export declare class Host extends BaseClient {
861
1106
  /**
862
1107
  * Accesses a directory on the host.
1108
+ * @param path Location of the directory to access (e.g., ".").
1109
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1110
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
863
1111
  */
864
1112
  directory(path: string, opts?: HostDirectoryOpts): Directory;
865
1113
  /**
866
1114
  * Accesses an environment variable on the host.
1115
+ * @param name Name of the environment variable (e.g., "PATH").
867
1116
  */
868
1117
  envVariable(name: string): HostVariable;
869
1118
  /**
870
1119
  * Accesses a Unix socket on the host.
1120
+ * @param path Location of the Unix socket (e.g., "/var/run/docker.sock").
871
1121
  */
872
1122
  unixSocket(path: string): Socket;
873
1123
  /**
874
1124
  * Retrieves the current working directory on the host.
1125
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1126
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
875
1127
  * @deprecated Use directory with path set to '.' instead.
876
1128
  */
877
1129
  workdir(opts?: HostWorkdirOpts): Directory;
@@ -968,6 +1220,45 @@ export declare class Label extends BaseClient {
968
1220
  */
969
1221
  with(arg: (param: Label) => Label): Label;
970
1222
  }
1223
+ /**
1224
+ * A port exposed by a container.
1225
+ */
1226
+ export declare class Port extends BaseClient {
1227
+ /**
1228
+ * The port description.
1229
+ */
1230
+ description(): Promise<string>;
1231
+ /**
1232
+ * The port number.
1233
+ */
1234
+ port(): Promise<number>;
1235
+ /**
1236
+ * The transport layer network protocol.
1237
+ */
1238
+ protocol(): Promise<NetworkProtocol>;
1239
+ /**
1240
+ * Chain objects together
1241
+ * @example
1242
+ * ```ts
1243
+ * function AddAFewMounts(c) {
1244
+ * return c
1245
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1246
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1247
+ * }
1248
+ *
1249
+ * connect(async (client) => {
1250
+ * const tree = await client
1251
+ * .container()
1252
+ * .from("alpine")
1253
+ * .withWorkdir("/foo")
1254
+ * .with(AddAFewMounts)
1255
+ * .withExec(["ls", "-lh"])
1256
+ * .stdout()
1257
+ * })
1258
+ *```
1259
+ */
1260
+ with(arg: (param: Port) => Port): Port;
1261
+ }
971
1262
  /**
972
1263
  * A set of scripts and/or extensions
973
1264
  */
@@ -1022,13 +1313,15 @@ export declare class Project extends BaseClient {
1022
1313
  export default class Client extends BaseClient {
1023
1314
  /**
1024
1315
  * Constructs a cache volume for a given cache key.
1025
- * @param key A string identifier to target this cache volume (e.g. "myapp-cache").
1316
+ * @param key A string identifier to target this cache volume (e.g., "modules-cache").
1026
1317
  */
1027
1318
  cacheVolume(key: string): CacheVolume;
1028
1319
  /**
1029
1320
  * Loads a container from ID.
1321
+ *
1030
1322
  * Null ID returns an empty container (scratch).
1031
- * Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
1323
+ * Optional platform argument initializes new containers to execute and publish as that platform.
1324
+ * Platform defaults to that of the builder's host.
1032
1325
  */
1033
1326
  container(opts?: ClientContainerOpts): Container;
1034
1327
  /**
@@ -1045,6 +1338,11 @@ export default class Client extends BaseClient {
1045
1338
  file(id: FileID): File;
1046
1339
  /**
1047
1340
  * Queries a git repository.
1341
+ * @param url Url of the git repository.
1342
+ * Can be formatted as https://{host}/{owner}/{repo}, git@{host}/{owner}/{repo}
1343
+ * Suffix ".git" is optional.
1344
+ * @param opts.keepGitDir Set to true to keep .git directory.
1345
+ * @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
1048
1346
  */
1049
1347
  git(url: string, opts?: ClientGitOpts): GitRepository;
1050
1348
  /**
@@ -1053,8 +1351,10 @@ export default class Client extends BaseClient {
1053
1351
  host(): Host;
1054
1352
  /**
1055
1353
  * Returns a file containing an http remote url content.
1354
+ * @param url HTTP url to get the content from (e.g., "https://docs.dagger.io").
1355
+ * @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
1056
1356
  */
1057
- http(url: string): File;
1357
+ http(url: string, opts?: ClientHttpOpts): File;
1058
1358
  /**
1059
1359
  * Creates a named sub-pipeline
1060
1360
  */