@dagger.io/dagger 0.3.4 → 0.4.0

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
  /**
@@ -107,7 +124,14 @@ export type ContainerExportOpts = {
107
124
  platformVariants?: Container[];
108
125
  };
109
126
  export type ContainerPipelineOpts = {
127
+ /**
128
+ * Pipeline description.
129
+ */
110
130
  description?: string;
131
+ /**
132
+ * Pipeline labels.
133
+ */
134
+ labels?: PipelineLabel[];
111
135
  };
112
136
  export type ContainerPublishOpts = {
113
137
  /**
@@ -117,38 +141,70 @@ export type ContainerPublishOpts = {
117
141
  platformVariants?: Container[];
118
142
  };
119
143
  export type ContainerWithDefaultArgsOpts = {
144
+ /**
145
+ * Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
146
+ */
120
147
  args?: string[];
121
148
  };
122
149
  export type ContainerWithDirectoryOpts = {
150
+ /**
151
+ * Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
152
+ */
123
153
  exclude?: string[];
154
+ /**
155
+ * Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
156
+ */
124
157
  include?: string[];
125
158
  };
126
159
  export type ContainerWithExecOpts = {
127
160
  /**
128
- * Content to write to the command's standard input before closing.
161
+ * Content to write to the command's standard input before closing (e.g., "Hello world").
129
162
  */
130
163
  stdin?: string;
131
164
  /**
132
- * Redirect the command's standard output to a file in the container.
165
+ * Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
133
166
  */
134
167
  redirectStdout?: string;
135
168
  /**
136
- * Redirect the command's standard error to a file in the container.
169
+ * Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
137
170
  */
138
171
  redirectStderr?: string;
139
172
  /**
140
- * Provide dagger access to the executed command.
173
+ * Provides dagger access to the executed command.
174
+ *
141
175
  * Do not use this option unless you trust the command being executed.
142
176
  * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
143
177
  */
144
178
  experimentalPrivilegedNesting?: boolean;
179
+ /**
180
+ * Execute the command with all root capabilities. This is similar to running a command
181
+ * with "sudo" or executing `docker run` with the `--privileged` flag. Containerization
182
+ * does not provide any security guarantees when using this option. It should only be used
183
+ * when absolutely necessary and only with trusted commands.
184
+ */
185
+ insecureRootCapabilities?: boolean;
186
+ };
187
+ export type ContainerWithExposedPortOpts = {
188
+ /**
189
+ * Transport layer network protocol
190
+ */
191
+ protocol?: NetworkProtocol;
192
+ /**
193
+ * Optional port description
194
+ */
195
+ description?: string;
145
196
  };
146
197
  export type ContainerWithFileOpts = {
198
+ /**
199
+ * Permission given to the copied file (e.g., 0600).
200
+ *
201
+ * Default: 0644.
202
+ */
147
203
  permissions?: number;
148
204
  };
149
205
  export type ContainerWithMountedCacheOpts = {
150
206
  /**
151
- * Directory to use as the cache volume's root.
207
+ * Identifier of the directory to use as the cache volume's root.
152
208
  */
153
209
  source?: Directory;
154
210
  /**
@@ -157,9 +213,23 @@ export type ContainerWithMountedCacheOpts = {
157
213
  sharing?: CacheSharingMode;
158
214
  };
159
215
  export type ContainerWithNewFileOpts = {
216
+ /**
217
+ * Content of the file to write (e.g., "Hello world!").
218
+ */
160
219
  contents?: string;
220
+ /**
221
+ * Permission given to the written file (e.g., 0600).
222
+ *
223
+ * Default: 0644.
224
+ */
161
225
  permissions?: number;
162
226
  };
227
+ export type ContainerWithoutExposedPortOpts = {
228
+ /**
229
+ * Port protocol to unexpose
230
+ */
231
+ protocol?: NetworkProtocol;
232
+ };
163
233
  /**
164
234
  * A unique container identifier. Null designates an empty container (scratch).
165
235
  */
@@ -174,8 +244,9 @@ export type DateTime = string & {
174
244
  };
175
245
  export type DirectoryDockerBuildOpts = {
176
246
  /**
177
- * Path to the Dockerfile to use.
178
- * Defaults to './Dockerfile'.
247
+ * Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
248
+ *
249
+ * Defaults: './Dockerfile'.
179
250
  */
180
251
  dockerfile?: string;
181
252
  /**
@@ -183,7 +254,7 @@ export type DirectoryDockerBuildOpts = {
183
254
  */
184
255
  platform?: Platform;
185
256
  /**
186
- * Additional build arguments.
257
+ * Build arguments to use in the build.
187
258
  */
188
259
  buildArgs?: BuildArg[];
189
260
  /**
@@ -192,30 +263,53 @@ export type DirectoryDockerBuildOpts = {
192
263
  target?: string;
193
264
  };
194
265
  export type DirectoryEntriesOpts = {
266
+ /**
267
+ * Location of the directory to look at (e.g., "/src").
268
+ */
195
269
  path?: string;
196
270
  };
197
271
  export type DirectoryPipelineOpts = {
272
+ /**
273
+ * Pipeline description.
274
+ */
198
275
  description?: string;
276
+ /**
277
+ * Pipeline labels.
278
+ */
279
+ labels?: PipelineLabel[];
199
280
  };
200
281
  export type DirectoryWithDirectoryOpts = {
201
282
  /**
202
- * Exclude artifacts that match the given pattern.
203
- * (e.g. ["node_modules/", ".git*"]).
283
+ * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
204
284
  */
205
285
  exclude?: string[];
206
286
  /**
207
- * Include only artifacts that match the given pattern.
208
- * (e.g. ["app/", "package.*"]).
287
+ * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
209
288
  */
210
289
  include?: string[];
211
290
  };
212
291
  export type DirectoryWithFileOpts = {
292
+ /**
293
+ * Permission given to the copied file (e.g., 0600).
294
+ *
295
+ * Default: 0644.
296
+ */
213
297
  permissions?: number;
214
298
  };
215
299
  export type DirectoryWithNewDirectoryOpts = {
300
+ /**
301
+ * Permission granted to the created directory (e.g., 0777).
302
+ *
303
+ * Default: 0755.
304
+ */
216
305
  permissions?: number;
217
306
  };
218
307
  export type DirectoryWithNewFileOpts = {
308
+ /**
309
+ * Permission given to the copied file (e.g., 0600).
310
+ *
311
+ * Default: 0644.
312
+ */
219
313
  permissions?: number;
220
314
  };
221
315
  /**
@@ -235,11 +329,23 @@ export type GitRefTreeOpts = {
235
329
  sshAuthSocket?: Socket;
236
330
  };
237
331
  export type HostDirectoryOpts = {
332
+ /**
333
+ * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
334
+ */
238
335
  exclude?: string[];
336
+ /**
337
+ * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
338
+ */
239
339
  include?: string[];
240
340
  };
241
341
  export type HostWorkdirOpts = {
342
+ /**
343
+ * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
344
+ */
242
345
  exclude?: string[];
346
+ /**
347
+ * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
348
+ */
243
349
  include?: string[];
244
350
  };
245
351
  /**
@@ -248,9 +354,33 @@ export type HostWorkdirOpts = {
248
354
  export type ID = string & {
249
355
  __ID: never;
250
356
  };
357
+ /**
358
+ * Transport layer network protocol associated to a port.
359
+ */
360
+ export declare enum NetworkProtocol {
361
+ /**
362
+ * TCP (Transmission Control Protocol)
363
+ */
364
+ Tcp = 0,
365
+ /**
366
+ * UDP (User Datagram Protocol)
367
+ */
368
+ Udp = 1
369
+ }
370
+ export type PipelineLabel = {
371
+ /**
372
+ * Label name.
373
+ */
374
+ name: string;
375
+ /**
376
+ * Label value.
377
+ */
378
+ value: string;
379
+ };
251
380
  /**
252
381
  * 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).
382
+ *
383
+ * The format is [os]/[platform]/[version] (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64").
254
384
  */
255
385
  export type Platform = string & {
256
386
  __Platform: never;
@@ -263,10 +393,30 @@ export type ClientDirectoryOpts = {
263
393
  id?: DirectoryID;
264
394
  };
265
395
  export type ClientGitOpts = {
396
+ /**
397
+ * Set to true to keep .git directory.
398
+ */
266
399
  keepGitDir?: boolean;
400
+ /**
401
+ * A service which must be started before the repo is fetched.
402
+ */
403
+ experimentalServiceHost?: Container;
404
+ };
405
+ export type ClientHttpOpts = {
406
+ /**
407
+ * A service which must be started before the URL is fetched.
408
+ */
409
+ experimentalServiceHost?: Container;
267
410
  };
268
411
  export type ClientPipelineOpts = {
412
+ /**
413
+ * Pipeline description.
414
+ */
269
415
  description?: string;
416
+ /**
417
+ * Pipeline labels.
418
+ */
419
+ labels?: PipelineLabel[];
270
420
  };
271
421
  export type ClientSocketOpts = {
272
422
  id?: SocketID;
@@ -322,10 +472,11 @@ export declare class CacheVolume extends BaseClient {
322
472
  */
323
473
  export declare class Container extends BaseClient {
324
474
  /**
325
- * Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
475
+ * Initializes this container from a Dockerfile build.
326
476
  * @param context Directory context used by the Dockerfile.
327
477
  * @param opts.dockerfile Path to the Dockerfile to use.
328
- Defaults to './Dockerfile'.
478
+ *
479
+ * Default: './Dockerfile'.
329
480
  * @param opts.buildArgs Additional build arguments.
330
481
  * @param opts.target Target build stage to build.
331
482
  */
@@ -335,15 +486,31 @@ export declare class Container extends BaseClient {
335
486
  */
336
487
  defaultArgs(): Promise<string[]>;
337
488
  /**
338
- * Retrieves a directory at the given path. Mounts are included.
489
+ * Retrieves a directory at the given path.
490
+ *
491
+ * Mounts are included.
492
+ * @param path The path of the directory to retrieve (e.g., "./src").
339
493
  */
340
494
  directory(path: string): Directory;
495
+ /**
496
+ * Retrieves an endpoint that clients can use to reach this container.
497
+ *
498
+ * If no port is specified, the first exposed port is used. If none exist an error is returned.
499
+ *
500
+ * If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
501
+ *
502
+ * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
503
+ * @param opts.port The exposed port number for the endpoint
504
+ * @param opts.scheme Return a URL with the given scheme, eg. http for http://
505
+ */
506
+ endpoint(opts?: ContainerEndpointOpts): Promise<string>;
341
507
  /**
342
508
  * Retrieves entrypoint to be prepended to the arguments of all commands.
343
509
  */
344
510
  entrypoint(): Promise<string[]>;
345
511
  /**
346
512
  * Retrieves the value of the specified environment variable.
513
+ * @param name The name of the environment variable to retrieve (e.g., "PATH").
347
514
  */
348
515
  envVariable(name: string): Promise<string>;
349
516
  /**
@@ -352,38 +519,50 @@ export declare class Container extends BaseClient {
352
519
  envVariables(): Promise<EnvVariable[]>;
353
520
  /**
354
521
  * 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.
522
+ * @param opts.args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
523
+ * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
524
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
525
+ * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
359
526
  * @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.
527
+ * Do not use this option unless you trust the command being executed.
528
+ * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
362
529
  * @deprecated Replaced by withExec.
363
530
  */
364
531
  exec(opts?: ContainerExecOpts): Container;
365
532
  /**
366
533
  * Exit code of the last executed command. Zero means success.
367
- * Null if no command has been executed.
534
+ * Errors if no command has been executed.
368
535
  */
369
536
  exitCode(): Promise<number>;
370
537
  /**
371
- * Writes the container as an OCI tarball to the destination file path on the host for the specified platformVariants.
538
+ * Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.
539
+ *
372
540
  * Return true on success.
373
- * @param path Host's destination path.
374
- Path can be relative to the engine's workdir or absolute.
541
+ * It can also publishes platform variants.
542
+ * @param path Host's destination path (e.g., "./tarball").
543
+ * Path can be relative to the engine's workdir or absolute.
375
544
  * @param opts.platformVariants Identifiers for other platform specific containers.
376
- Used for multi-platform image.
545
+ * Used for multi-platform image.
377
546
  */
378
547
  export(path: string, opts?: ContainerExportOpts): Promise<boolean>;
379
548
  /**
380
- * Retrieves a file at the given path. Mounts are included.
549
+ * Retrieves the list of exposed ports.
550
+ *
551
+ * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
552
+ */
553
+ exposedPorts(): Promise<Port[]>;
554
+ /**
555
+ * Retrieves a file at the given path.
556
+ *
557
+ * Mounts are included.
558
+ * @param path The path of the file to retrieve (e.g., "./README.md").
381
559
  */
382
560
  file(path: string): File;
383
561
  /**
384
- * Initializes this container from the base image published at the given address.
562
+ * Initializes this container from a pulled base image.
385
563
  * @param address Image's address from its registry.
386
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
564
+ *
565
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
387
566
  */
388
567
  from(address: string): Container;
389
568
  /**
@@ -391,10 +570,20 @@ export declare class Container extends BaseClient {
391
570
  * @deprecated Replaced by rootfs.
392
571
  */
393
572
  fs(): Directory;
573
+ /**
574
+ * Retrieves a hostname which can be used by clients to reach this container.
575
+ *
576
+ * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
577
+ */
578
+ hostname(): Promise<string>;
394
579
  /**
395
580
  * A unique identifier for this container.
396
581
  */
397
582
  id(): Promise<ContainerID>;
583
+ /**
584
+ * The unique image reference which can only be retrieved immediately after the 'Container.From' call.
585
+ */
586
+ imageRef(): Promise<string>;
398
587
  /**
399
588
  * Retrieves the value of the specified label.
400
589
  */
@@ -409,6 +598,9 @@ export declare class Container extends BaseClient {
409
598
  mounts(): Promise<string[]>;
410
599
  /**
411
600
  * Creates a named sub-pipeline
601
+ * @param name Pipeline name.
602
+ * @param opts.description Pipeline description.
603
+ * @param opts.labels Pipeline labels.
412
604
  */
413
605
  pipeline(name: string, opts?: ContainerPipelineOpts): Container;
414
606
  /**
@@ -416,11 +608,15 @@ export declare class Container extends BaseClient {
416
608
  */
417
609
  platform(): Promise<Platform>;
418
610
  /**
419
- * Publishes this container as a new image to the specified address, for the platformVariants, returning a fully qualified ref.
611
+ * Publishes this container as a new image to the specified address.
612
+ *
613
+ * Publish returns a fully qualified ref.
614
+ * It can also publish platform variants.
420
615
  * @param address Registry's address to publish the image to.
421
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
616
+ *
617
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
422
618
  * @param opts.platformVariants Identifiers for other platform specific containers.
423
- Used for multi-platform image.
619
+ * Used for multi-platform image.
424
620
  */
425
621
  publish(address: string, opts?: ContainerPublishOpts): Promise<string>;
426
622
  /**
@@ -429,12 +625,12 @@ export declare class Container extends BaseClient {
429
625
  rootfs(): Directory;
430
626
  /**
431
627
  * The error stream of the last executed command.
432
- * Null if no command has been executed.
628
+ * Errors if no command has been executed.
433
629
  */
434
630
  stderr(): Promise<string>;
435
631
  /**
436
632
  * The output stream of the last executed command.
437
- * Null if no command has been executed.
633
+ * Errors if no command has been executed.
438
634
  */
439
635
  stdout(): Promise<string>;
440
636
  /**
@@ -443,31 +639,57 @@ export declare class Container extends BaseClient {
443
639
  user(): Promise<string>;
444
640
  /**
445
641
  * Configures default arguments for future commands.
642
+ * @param opts.args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
446
643
  */
447
644
  withDefaultArgs(opts?: ContainerWithDefaultArgsOpts): Container;
448
645
  /**
449
646
  * Retrieves this container plus a directory written at the given path.
647
+ * @param path Location of the written directory (e.g., "/tmp/directory").
648
+ * @param directory Identifier of the directory to write
649
+ * @param opts.exclude Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
650
+ * @param opts.include Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
450
651
  */
451
652
  withDirectory(path: string, directory: Directory, opts?: ContainerWithDirectoryOpts): Container;
452
653
  /**
453
654
  * Retrieves this container but with a different command entrypoint.
655
+ * @param args Entrypoint to use for future executions (e.g., ["go", "run"]).
454
656
  */
455
657
  withEntrypoint(args: string[]): Container;
456
658
  /**
457
659
  * Retrieves this container plus the given environment variable.
660
+ * @param name The name of the environment variable (e.g., "HOST").
661
+ * @param value The value of the environment variable. (e.g., "localhost").
458
662
  */
459
663
  withEnvVariable(name: string, value: string): Container;
460
664
  /**
461
665
  * 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.
666
+ * @param args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
667
+ * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
668
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
669
+ * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
670
+ * @param opts.experimentalPrivilegedNesting Provides dagger access to the executed command.
671
+ *
672
+ * Do not use this option unless you trust the command being executed.
673
+ * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
674
+ * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command
675
+ * with "sudo" or executing `docker run` with the `--privileged` flag. Containerization
676
+ * does not provide any security guarantees when using this option. It should only be used
677
+ * when absolutely necessary and only with trusted commands.
469
678
  */
470
679
  withExec(args: string[], opts?: ContainerWithExecOpts): Container;
680
+ /**
681
+ * Expose a network port.
682
+ *
683
+ * Exposed ports serve two purposes:
684
+ * - For health checks and introspection, when running services
685
+ * - For setting the EXPOSE OCI field when publishing the container
686
+ *
687
+ * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
688
+ * @param port Port number to expose
689
+ * @param opts.protocol Transport layer network protocol
690
+ * @param opts.description Optional port description
691
+ */
692
+ withExposedPort(port: number, opts?: ContainerWithExposedPortOpts): Container;
471
693
  /**
472
694
  * Initializes this container from this DirectoryID.
473
695
  * @deprecated Replaced by withRootfs.
@@ -475,44 +697,63 @@ export declare class Container extends BaseClient {
475
697
  withFS(id: Directory): Container;
476
698
  /**
477
699
  * Retrieves this container plus the contents of the given file copied to the given path.
700
+ * @param path Location of the copied file (e.g., "/tmp/file.txt").
701
+ * @param source Identifier of the file to copy.
702
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
703
+ *
704
+ * Default: 0644.
478
705
  */
479
706
  withFile(path: string, source: File, opts?: ContainerWithFileOpts): Container;
480
707
  /**
481
708
  * Retrieves this container plus the given label.
709
+ * @param name The name of the label (e.g., "org.opencontainers.artifact.created").
710
+ * @param value The value of the label (e.g., "2023-01-01T00:00:00Z").
482
711
  */
483
712
  withLabel(name: string, value: string): Container;
484
713
  /**
485
714
  * 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.
715
+ * @param path Location of the cache directory (e.g., "/cache/node_modules").
716
+ * @param cache Identifier of the cache volume to mount.
717
+ * @param opts.source Identifier of the directory to use as the cache volume's root.
489
718
  * @param opts.sharing Sharing mode of the cache volume.
490
719
  */
491
720
  withMountedCache(path: string, cache: CacheVolume, opts?: ContainerWithMountedCacheOpts): Container;
492
721
  /**
493
722
  * Retrieves this container plus a directory mounted at the given path.
723
+ * @param path Location of the mounted directory (e.g., "/mnt/directory").
724
+ * @param source Identifier of the mounted directory.
494
725
  */
495
726
  withMountedDirectory(path: string, source: Directory): Container;
496
727
  /**
497
728
  * Retrieves this container plus a file mounted at the given path.
729
+ * @param path Location of the mounted file (e.g., "/tmp/file.txt").
730
+ * @param source Identifier of the mounted file.
498
731
  */
499
732
  withMountedFile(path: string, source: File): Container;
500
733
  /**
501
734
  * Retrieves this container plus a secret mounted into a file at the given path.
735
+ * @param path Location of the secret file (e.g., "/tmp/secret.txt").
736
+ * @param source Identifier of the secret to mount.
502
737
  */
503
738
  withMountedSecret(path: string, source: Secret): Container;
504
739
  /**
505
740
  * Retrieves this container plus a temporary directory mounted at the given path.
741
+ * @param path Location of the temporary directory (e.g., "/tmp/temp_dir").
506
742
  */
507
743
  withMountedTemp(path: string): Container;
508
744
  /**
509
745
  * Retrieves this container plus a new file written at the given path.
746
+ * @param path Location of the written file (e.g., "/tmp/file.txt").
747
+ * @param opts.contents Content of the file to write (e.g., "Hello world!").
748
+ * @param opts.permissions Permission given to the written file (e.g., 0600).
749
+ *
750
+ * Default: 0644.
510
751
  */
511
752
  withNewFile(path: string, opts?: ContainerWithNewFileOpts): Container;
512
753
  /**
513
754
  * Retrieves this container with a registry authentication for a given address.
514
755
  * @param address Registry's address to bind the authentication to.
515
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
756
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
516
757
  * @param username The username of the registry's account (e.g., "Dagger").
517
758
  * @param secret The API key, password or token to authenticate to this registry.
518
759
  */
@@ -523,40 +764,70 @@ export declare class Container extends BaseClient {
523
764
  withRootfs(id: Directory): Container;
524
765
  /**
525
766
  * Retrieves this container plus an env variable containing the given secret.
767
+ * @param name The name of the secret variable (e.g., "API_SECRET").
768
+ * @param secret The identifier of the secret value.
526
769
  */
527
770
  withSecretVariable(name: string, secret: Secret): Container;
771
+ /**
772
+ * Establish a runtime dependency on a service. The service will be started automatically when needed and detached when it is no longer needed.
773
+ *
774
+ * The service will be reachable from the container via the provided hostname alias.
775
+ *
776
+ * The service dependency will also convey to any files or directories produced by the container.
777
+ *
778
+ * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
779
+ * @param alias A name that can be used to reach the service from the container
780
+ * @param service Identifier of the service container
781
+ */
782
+ withServiceBinding(alias: string, service: Container): Container;
528
783
  /**
529
784
  * Retrieves this container plus a socket forwarded to the given Unix socket path.
785
+ * @param path Location of the forwarded Unix socket (e.g., "/tmp/socket").
786
+ * @param source Identifier of the socket to forward.
530
787
  */
531
788
  withUnixSocket(path: string, source: Socket): Container;
532
789
  /**
533
- * Retrieves this containers with a different command user.
790
+ * Retrieves this container with a different command user.
791
+ * @param name The user to set (e.g., "root").
534
792
  */
535
793
  withUser(name: string): Container;
536
794
  /**
537
795
  * Retrieves this container with a different working directory.
796
+ * @param path The path to set as the working directory (e.g., "/app").
538
797
  */
539
798
  withWorkdir(path: string): Container;
540
799
  /**
541
800
  * Retrieves this container minus the given environment variable.
801
+ * @param name The name of the environment variable (e.g., "HOST").
542
802
  */
543
803
  withoutEnvVariable(name: string): Container;
804
+ /**
805
+ * Unexpose a previously exposed port.
806
+ *
807
+ * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
808
+ * @param port Port number to unexpose
809
+ * @param opts.protocol Port protocol to unexpose
810
+ */
811
+ withoutExposedPort(port: number, opts?: ContainerWithoutExposedPortOpts): Container;
544
812
  /**
545
813
  * Retrieves this container minus the given environment label.
814
+ * @param name The name of the label to remove (e.g., "org.opencontainers.artifact.created").
546
815
  */
547
816
  withoutLabel(name: string): Container;
548
817
  /**
549
818
  * Retrieves this container after unmounting everything at the given path.
819
+ * @param path Location of the cache directory (e.g., "/cache/node_modules").
550
820
  */
551
821
  withoutMount(path: string): Container;
552
822
  /**
553
823
  * Retrieves this container without the registry authentication of a given address.
554
824
  * @param address Registry's address to remove the authentication from.
555
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
825
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
556
826
  */
557
827
  withoutRegistryAuth(address: string): Container;
558
828
  /**
559
829
  * Retrieves this container with a previously added Unix socket removed.
830
+ * @param path Location of the socket to remove (e.g., "/tmp/socket").
560
831
  */
561
832
  withoutUnixSocket(path: string): Container;
562
833
  /**
@@ -592,31 +863,37 @@ export declare class Container extends BaseClient {
592
863
  export declare class Directory extends BaseClient {
593
864
  /**
594
865
  * Gets the difference between this directory and an another directory.
866
+ * @param other Identifier of the directory to compare.
595
867
  */
596
868
  diff(other: Directory): Directory;
597
869
  /**
598
870
  * Retrieves a directory at the given path.
871
+ * @param path Location of the directory to retrieve (e.g., "/src").
599
872
  */
600
873
  directory(path: string): Directory;
601
874
  /**
602
875
  * Builds a new Docker container from this directory.
603
- * @param opts.dockerfile Path to the Dockerfile to use.
604
- Defaults to './Dockerfile'.
876
+ * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
877
+ *
878
+ * Defaults: './Dockerfile'.
605
879
  * @param opts.platform The platform to build.
606
- * @param opts.buildArgs Additional build arguments.
880
+ * @param opts.buildArgs Build arguments to use in the build.
607
881
  * @param opts.target Target build stage to build.
608
882
  */
609
883
  dockerBuild(opts?: DirectoryDockerBuildOpts): Container;
610
884
  /**
611
885
  * Returns a list of files and directories at the given path.
886
+ * @param opts.path Location of the directory to look at (e.g., "/src").
612
887
  */
613
888
  entries(opts?: DirectoryEntriesOpts): Promise<string[]>;
614
889
  /**
615
890
  * Writes the contents of the directory to a path on the host.
891
+ * @param path Location of the copied directory (e.g., "logs/").
616
892
  */
617
893
  export(path: string): Promise<boolean>;
618
894
  /**
619
895
  * Retrieves a file at the given path.
896
+ * @param path Location of the file to retrieve (e.g., "README.md").
620
897
  */
621
898
  file(path: string): File;
622
899
  /**
@@ -628,39 +905,61 @@ export declare class Directory extends BaseClient {
628
905
  */
629
906
  loadProject(configPath: string): Project;
630
907
  /**
631
- * Creates a named sub-pipeline.
908
+ * Creates a named sub-pipeline
909
+ * @param name Pipeline name.
910
+ * @param opts.description Pipeline description.
911
+ * @param opts.labels Pipeline labels.
632
912
  */
633
913
  pipeline(name: string, opts?: DirectoryPipelineOpts): Directory;
634
914
  /**
635
915
  * 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.*"]).
916
+ * @param path Location of the written directory (e.g., "/src/").
917
+ * @param directory Identifier of the directory to copy.
918
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
919
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
640
920
  */
641
921
  withDirectory(path: string, directory: Directory, opts?: DirectoryWithDirectoryOpts): Directory;
642
922
  /**
643
923
  * Retrieves this directory plus the contents of the given file copied to the given path.
924
+ * @param path Location of the copied file (e.g., "/file.txt").
925
+ * @param source Identifier of the file to copy.
926
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
927
+ *
928
+ * Default: 0644.
644
929
  */
645
930
  withFile(path: string, source: File, opts?: DirectoryWithFileOpts): Directory;
646
931
  /**
647
932
  * Retrieves this directory plus a new directory created at the given path.
933
+ * @param path Location of the directory created (e.g., "/logs").
934
+ * @param opts.permissions Permission granted to the created directory (e.g., 0777).
935
+ *
936
+ * Default: 0755.
648
937
  */
649
938
  withNewDirectory(path: string, opts?: DirectoryWithNewDirectoryOpts): Directory;
650
939
  /**
651
940
  * Retrieves this directory plus a new file written at the given path.
941
+ * @param path Location of the written file (e.g., "/file.txt").
942
+ * @param contents Content of the written file (e.g., "Hello world!").
943
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
944
+ *
945
+ * Default: 0644.
652
946
  */
653
947
  withNewFile(path: string, contents: string, opts?: DirectoryWithNewFileOpts): Directory;
654
948
  /**
655
- * Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
949
+ * Retrieves this directory with all file/dir timestamps set to the given time.
950
+ * @param timestamp Timestamp to set dir/files in.
951
+ *
952
+ * Formatted in seconds following Unix epoch (e.g., 1672531199).
656
953
  */
657
954
  withTimestamps(timestamp: number): Directory;
658
955
  /**
659
956
  * Retrieves this directory with the directory at the given path removed.
957
+ * @param path Location of the directory to remove (e.g., ".github/").
660
958
  */
661
959
  withoutDirectory(path: string): Directory;
662
960
  /**
663
961
  * Retrieves this directory with the file at the given path removed.
962
+ * @param path Location of the file to remove (e.g., "/file.txt").
664
963
  */
665
964
  withoutFile(path: string): Directory;
666
965
  /**
@@ -731,6 +1030,7 @@ export declare class File extends BaseClient {
731
1030
  contents(): Promise<string>;
732
1031
  /**
733
1032
  * Writes the file to a file path on the host.
1033
+ * @param path Location of the written directory (e.g., "output.txt").
734
1034
  */
735
1035
  export(path: string): Promise<boolean>;
736
1036
  /**
@@ -746,7 +1046,10 @@ export declare class File extends BaseClient {
746
1046
  */
747
1047
  size(): Promise<number>;
748
1048
  /**
749
- * Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
1049
+ * Retrieves this file with its created/modified timestamps set to the given time.
1050
+ * @param timestamp Timestamp to set dir/files in.
1051
+ *
1052
+ * Formatted in seconds following Unix epoch (e.g., 1672531199).
750
1053
  */
751
1054
  withTimestamps(timestamp: number): File;
752
1055
  /**
@@ -813,6 +1116,7 @@ export declare class GitRef extends BaseClient {
813
1116
  export declare class GitRepository extends BaseClient {
814
1117
  /**
815
1118
  * Returns details on one branch.
1119
+ * @param name Branch's name (e.g., "main").
816
1120
  */
817
1121
  branch(name: string): GitRef;
818
1122
  /**
@@ -821,10 +1125,12 @@ export declare class GitRepository extends BaseClient {
821
1125
  branches(): Promise<string[]>;
822
1126
  /**
823
1127
  * Returns details on one commit.
1128
+ * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
824
1129
  */
825
1130
  commit(id: string): GitRef;
826
1131
  /**
827
1132
  * Returns details on one tag.
1133
+ * @param name Tag's name (e.g., "v0.3.9").
828
1134
  */
829
1135
  tag(name: string): GitRef;
830
1136
  /**
@@ -860,18 +1166,25 @@ export declare class GitRepository extends BaseClient {
860
1166
  export declare class Host extends BaseClient {
861
1167
  /**
862
1168
  * Accesses a directory on the host.
1169
+ * @param path Location of the directory to access (e.g., ".").
1170
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1171
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
863
1172
  */
864
1173
  directory(path: string, opts?: HostDirectoryOpts): Directory;
865
1174
  /**
866
1175
  * Accesses an environment variable on the host.
1176
+ * @param name Name of the environment variable (e.g., "PATH").
867
1177
  */
868
1178
  envVariable(name: string): HostVariable;
869
1179
  /**
870
1180
  * Accesses a Unix socket on the host.
1181
+ * @param path Location of the Unix socket (e.g., "/var/run/docker.sock").
871
1182
  */
872
1183
  unixSocket(path: string): Socket;
873
1184
  /**
874
1185
  * Retrieves the current working directory on the host.
1186
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1187
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
875
1188
  * @deprecated Use directory with path set to '.' instead.
876
1189
  */
877
1190
  workdir(opts?: HostWorkdirOpts): Directory;
@@ -968,6 +1281,45 @@ export declare class Label extends BaseClient {
968
1281
  */
969
1282
  with(arg: (param: Label) => Label): Label;
970
1283
  }
1284
+ /**
1285
+ * A port exposed by a container.
1286
+ */
1287
+ export declare class Port extends BaseClient {
1288
+ /**
1289
+ * The port description.
1290
+ */
1291
+ description(): Promise<string>;
1292
+ /**
1293
+ * The port number.
1294
+ */
1295
+ port(): Promise<number>;
1296
+ /**
1297
+ * The transport layer network protocol.
1298
+ */
1299
+ protocol(): Promise<NetworkProtocol>;
1300
+ /**
1301
+ * Chain objects together
1302
+ * @example
1303
+ * ```ts
1304
+ * function AddAFewMounts(c) {
1305
+ * return c
1306
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1307
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1308
+ * }
1309
+ *
1310
+ * connect(async (client) => {
1311
+ * const tree = await client
1312
+ * .container()
1313
+ * .from("alpine")
1314
+ * .withWorkdir("/foo")
1315
+ * .with(AddAFewMounts)
1316
+ * .withExec(["ls", "-lh"])
1317
+ * .stdout()
1318
+ * })
1319
+ *```
1320
+ */
1321
+ with(arg: (param: Port) => Port): Port;
1322
+ }
971
1323
  /**
972
1324
  * A set of scripts and/or extensions
973
1325
  */
@@ -1022,13 +1374,15 @@ export declare class Project extends BaseClient {
1022
1374
  export default class Client extends BaseClient {
1023
1375
  /**
1024
1376
  * Constructs a cache volume for a given cache key.
1025
- * @param key A string identifier to target this cache volume (e.g. "myapp-cache").
1377
+ * @param key A string identifier to target this cache volume (e.g., "modules-cache").
1026
1378
  */
1027
1379
  cacheVolume(key: string): CacheVolume;
1028
1380
  /**
1029
1381
  * Loads a container from ID.
1382
+ *
1030
1383
  * 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.
1384
+ * Optional platform argument initializes new containers to execute and publish as that platform.
1385
+ * Platform defaults to that of the builder's host.
1032
1386
  */
1033
1387
  container(opts?: ClientContainerOpts): Container;
1034
1388
  /**
@@ -1045,6 +1399,11 @@ export default class Client extends BaseClient {
1045
1399
  file(id: FileID): File;
1046
1400
  /**
1047
1401
  * Queries a git repository.
1402
+ * @param url Url of the git repository.
1403
+ * Can be formatted as https://{host}/{owner}/{repo}, git@{host}/{owner}/{repo}
1404
+ * Suffix ".git" is optional.
1405
+ * @param opts.keepGitDir Set to true to keep .git directory.
1406
+ * @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
1048
1407
  */
1049
1408
  git(url: string, opts?: ClientGitOpts): GitRepository;
1050
1409
  /**
@@ -1053,10 +1412,15 @@ export default class Client extends BaseClient {
1053
1412
  host(): Host;
1054
1413
  /**
1055
1414
  * Returns a file containing an http remote url content.
1415
+ * @param url HTTP url to get the content from (e.g., "https://docs.dagger.io").
1416
+ * @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
1056
1417
  */
1057
- http(url: string): File;
1418
+ http(url: string, opts?: ClientHttpOpts): File;
1058
1419
  /**
1059
- * Creates a named sub-pipeline
1420
+ * Creates a named sub-pipeline.
1421
+ * @param name Pipeline name.
1422
+ * @param opts.description Pipeline description.
1423
+ * @param opts.labels Pipeline labels.
1060
1424
  */
1061
1425
  pipeline(name: string, opts?: ClientPipelineOpts): Client;
1062
1426
  /**