@pulumi/docker 4.6.0-alpha.4 → 4.6.0-beta.2

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.
package/buildx/image.d.ts CHANGED
@@ -1,8 +1,442 @@
1
1
  import * as pulumi from "@pulumi/pulumi";
2
2
  import * as inputs from "../types/input";
3
3
  import * as outputs from "../types/output";
4
+ import * as enums from "../types/enums";
4
5
  /**
5
- * A Docker image built using Buildkit
6
+ * A Docker image built using buildx -- Docker's interface to the improved
7
+ * BuildKit backend.
8
+ *
9
+ * ## Stability
10
+ *
11
+ * **This resource is experimental and subject to change.**
12
+ *
13
+ * API types are unstable. Subsequent releases _may_ require manual edits
14
+ * to your state file(s) in order to adopt API changes.
15
+ *
16
+ * `retainOnDelete: true` is recommended with this resource until it is
17
+ * stable. This enables future API changes to be adopted more easily by renaming
18
+ * resources.
19
+ *
20
+ * Only use this resource if you understand and accept the risks.
21
+ *
22
+ * ## Migrating v3 and v4 Image resources
23
+ *
24
+ * The `buildx.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
25
+ * Existing `Image` resources can be converted to `build.Image` resources with minor modifications.
26
+ *
27
+ * ### Behavioral differences
28
+ *
29
+ * There are several key behavioral differences to keep in mind when transitioning images to the new `buildx.Image` resource.
30
+ *
31
+ * #### Previews
32
+ *
33
+ * Version `3.x` of the Pulumi Docker provider always builds images during preview operations.
34
+ * This is helpful as a safeguard to prevent "broken" images from merging, but users found the behavior unnecessarily redundant when running previews and updates locally.
35
+ *
36
+ * Version `4.x` changed build-on-preview behavior to be opt-in.
37
+ * By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
38
+ * Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
39
+ *
40
+ * The default behavior of the `buildx.Image` resource has been changed to strike a better balance between CI use cases and manual updates.
41
+ * By default, Pulumi will now only build `buildx.Image` resources during previews when it detects a CI environment like GitHub Actions.
42
+ * Previews run in non-CI environments will not build images.
43
+ * This behavior is still configurable with `buildOnPreview`.
44
+ *
45
+ * #### Push behavior
46
+ *
47
+ * Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
48
+ * They expose a `skipPush: true` option to disable pushing.
49
+ *
50
+ * The `buildx.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
51
+ *
52
+ * To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
53
+ * Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
54
+ *
55
+ * #### Secrets
56
+ *
57
+ * Version `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field.
58
+ *
59
+ * Version `4.x` of the Pulumi Docker provider does not support secrets.
60
+ *
61
+ * The `buildx.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
62
+ * Instead, they should be passed directly as values.
63
+ * (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
64
+ * Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
65
+ *
66
+ * #### Caching
67
+ *
68
+ * Version `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`.
69
+ * It builds targets individually and pushes them to separate images for caching.
70
+ *
71
+ * Version `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches.
72
+ *
73
+ * Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
74
+ * This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
75
+ *
76
+ * The `buildx.Image` resource delegates all caching behavior to Docker.
77
+ * `cacheFrom` and `cacheTo` options (equivalent to Docker's `--cache-to` and `--cache-from`) are exposed and provide additional cache targets, such as local disk, S3 storage, etc.
78
+ *
79
+ * #### Outputs
80
+ *
81
+ * TODO:
82
+ *
83
+ * #### Tag deletion and refreshes
84
+ *
85
+ * Versions 3 and 4 of Pulumi Docker provider do not delete tags when the `Image` resource is deleted, nor do they confirm expected tags exist during `refresh` operations.
86
+ *
87
+ * The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
88
+ * If any are missing a subsequent `update` will push them.
89
+ *
90
+ * When a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.
91
+ * Deletion of remote tags is not guaranteed, because not all registries currently support this operation (`docker.io` in particular).
92
+ *
93
+ * Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
94
+ *
95
+ * ### Example migration
96
+ *
97
+ * Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `buildx.Image` resource showing how they would look after migration.
98
+ *
99
+ * The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
100
+ * After migration, the environment variable is no longer needed and CLI flags are now properties on the `buildx.Image`.
101
+ * In almost all cases, properties of `buildx.Image` are named after the Docker CLI flag they correspond to.
102
+ *
103
+ * The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
104
+ * It it is shown with parameters similar to the `v3` example for completeness.
105
+ *
106
+ * ## Example Usage
107
+ * ### v3/v4 migration
108
+ *
109
+ * ```typescript
110
+ *
111
+ * // v3 Image
112
+ * const v3 = new docker.Image("v3-image", {
113
+ * imageName: "myregistry.com/user/repo:latest",
114
+ * localImageName: "local-tag",
115
+ * skipPush: false,
116
+ * build: {
117
+ * dockerfile: "./Dockerfile",
118
+ * context: "../app",
119
+ * target: "mytarget",
120
+ * args: {
121
+ * MY_BUILD_ARG: "foo",
122
+ * },
123
+ * env: {
124
+ * DOCKER_BUILDKIT: "1",
125
+ * },
126
+ * extraOptions: [
127
+ * "--cache-from",
128
+ * "type=registry,myregistry.com/user/repo:cache",
129
+ * "--cache-to",
130
+ * "type=registry,myregistry.com/user/repo:cache",
131
+ * "--add-host",
132
+ * "metadata.google.internal:169.254.169.254",
133
+ * "--secret",
134
+ * "id=mysecret,src=/local/secret",
135
+ * "--ssh",
136
+ * "default=/home/runner/.ssh/id_ed25519",
137
+ * "--network",
138
+ * "host",
139
+ * "--platform",
140
+ * "linux/amd64",
141
+ * ],
142
+ * },
143
+ * registry: {
144
+ * server: "myregistry.com",
145
+ * username: "username",
146
+ * password: pulumi.secret("password"),
147
+ * },
148
+ * });
149
+ *
150
+ * // v3 Image after migrating to buildx.Image
151
+ * const v3Migrated = new docker.buildx.Image("v3-to-buildx", {
152
+ * tags: ["myregistry.com/user/repo:latest", "local-tag"],
153
+ * push: true,
154
+ * dockerfile: {
155
+ * location: "./Dockerfile",
156
+ * },
157
+ * context: {
158
+ * location: "../app",
159
+ * },
160
+ * targets: ["mytarget"],
161
+ * buildArgs: {
162
+ * MY_BUILD_ARG: "foo",
163
+ * },
164
+ * cacheFrom: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
165
+ * cacheTo: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
166
+ * secrets: {
167
+ * mysecret: "value",
168
+ * },
169
+ * addHosts: ["metadata.google.internal:169.254.169.254"],
170
+ * ssh: {
171
+ * default: ["/home/runner/.ssh/id_ed25519"],
172
+ * },
173
+ * network: "host",
174
+ * platforms: ["linux/amd64"],
175
+ * registries: [{
176
+ * address: "myregistry.com",
177
+ * username: "username",
178
+ * password: pulumi.secret("password"),
179
+ * }],
180
+ * });
181
+ *
182
+ *
183
+ * // v4 Image
184
+ * const v4 = new docker.Image("v4-image", {
185
+ * imageName: "myregistry.com/user/repo:latest",
186
+ * skipPush: false,
187
+ * build: {
188
+ * dockerfile: "./Dockerfile",
189
+ * context: "../app",
190
+ * target: "mytarget",
191
+ * args: {
192
+ * MY_BUILD_ARG: "foo",
193
+ * },
194
+ * cacheFrom: {
195
+ * images: ["myregistry.com/user/repo:cache"],
196
+ * },
197
+ * addHosts: ["metadata.google.internal:169.254.169.254"],
198
+ * network: "host",
199
+ * platform: "linux/amd64",
200
+ * },
201
+ * buildOnPreview: true,
202
+ * registry: {
203
+ * server: "myregistry.com",
204
+ * username: "username",
205
+ * password: pulumi.secret("password"),
206
+ * },
207
+ * });
208
+ *
209
+ * // v4 Image after migrating to buildx.Image
210
+ * const v4Migrated = new docker.buildx.Image("v4-to-buildx", {
211
+ * tags: ["myregistry.com/user/repo:latest"],
212
+ * push: true,
213
+ * dockerfile: {
214
+ * location: "./Dockerfile",
215
+ * },
216
+ * context: {
217
+ * location: "../app",
218
+ * },
219
+ * targets: ["mytarget"],
220
+ * buildArgs: {
221
+ * MY_BUILD_ARG: "foo",
222
+ * },
223
+ * cacheFrom: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
224
+ * cacheTo: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
225
+ * addHosts: ["metadata.google.internal:169.254.169.254"],
226
+ * network: "host",
227
+ * platforms: ["linux/amd64"],
228
+ * registries: [{
229
+ * address: "myregistry.com",
230
+ * username: "username",
231
+ * password: pulumi.secret("password"),
232
+ * }],
233
+ * });
234
+ *
235
+ * ```
236
+ *
237
+ * ## Example Usage
238
+ * ### Push to AWS ECR with caching
239
+ *
240
+ * ```typescript
241
+ * import * as pulumi from "@pulumi/pulumi";
242
+ * import * as aws from "@pulumi/aws";
243
+ * import * as docker from "@pulumi/docker";
244
+ *
245
+ * const ecrRepository = new aws.ecr.Repository("ecr-repository", {});
246
+ * const authToken = aws.ecr.getAuthorizationTokenOutput({
247
+ * registryId: ecrRepository.registryId,
248
+ * });
249
+ * const myImage = new docker.buildx.Image("my-image", {
250
+ * cacheFrom: [{
251
+ * registry: {
252
+ * ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,
253
+ * },
254
+ * }],
255
+ * cacheTo: [{
256
+ * registry: {
257
+ * imageManifest: true,
258
+ * ociMediaTypes: true,
259
+ * ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,
260
+ * },
261
+ * }],
262
+ * context: {
263
+ * location: "./app",
264
+ * },
265
+ * dockerfile: {
266
+ * location: "./Dockerfile",
267
+ * },
268
+ * push: true,
269
+ * registries: [{
270
+ * address: ecrRepository.repositoryUrl,
271
+ * password: authToken.apply(authToken => authToken.password),
272
+ * username: authToken.apply(authToken => authToken.userName),
273
+ * }],
274
+ * tags: [pulumi.interpolate`${ecrRepository.repositoryUrl}:latest`],
275
+ * });
276
+ * ```
277
+ * ### Multi-platform image
278
+ *
279
+ * ```typescript
280
+ * import * as pulumi from "@pulumi/pulumi";
281
+ * import * as docker from "@pulumi/docker";
282
+ *
283
+ * const image = new docker.buildx.Image("image", {
284
+ * context: {
285
+ * location: "app",
286
+ * },
287
+ * platforms: [
288
+ * docker.buildx.image.Platform.Plan9_amd64,
289
+ * docker.buildx.image.Platform.Plan9_386,
290
+ * ],
291
+ * });
292
+ * ```
293
+ * ### Registry export
294
+ *
295
+ * ```typescript
296
+ * import * as pulumi from "@pulumi/pulumi";
297
+ * import * as docker from "@pulumi/docker";
298
+ *
299
+ * const image = new docker.buildx.Image("image", {
300
+ * context: {
301
+ * location: "app",
302
+ * },
303
+ * push: true,
304
+ * registries: [{
305
+ * address: "docker.io",
306
+ * password: dockerHubPassword,
307
+ * username: "pulumibot",
308
+ * }],
309
+ * tags: ["docker.io/pulumi/pulumi:3.107.0"],
310
+ * });
311
+ * ```
312
+ * ### Caching
313
+ *
314
+ * ```typescript
315
+ * import * as pulumi from "@pulumi/pulumi";
316
+ * import * as docker from "@pulumi/docker";
317
+ *
318
+ * const image = new docker.buildx.Image("image", {
319
+ * cacheFrom: [{
320
+ * local: {
321
+ * src: "tmp/cache",
322
+ * },
323
+ * }],
324
+ * cacheTo: [{
325
+ * local: {
326
+ * dest: "tmp/cache",
327
+ * mode: docker.buildx.image.CacheMode.Max,
328
+ * },
329
+ * }],
330
+ * context: {
331
+ * location: "app",
332
+ * },
333
+ * });
334
+ * ```
335
+ * ### Build arguments
336
+ *
337
+ * ```typescript
338
+ * import * as pulumi from "@pulumi/pulumi";
339
+ * import * as docker from "@pulumi/docker";
340
+ *
341
+ * const image = new docker.buildx.Image("image", {
342
+ * buildArgs: {
343
+ * SET_ME_TO_TRUE: "true",
344
+ * },
345
+ * context: {
346
+ * location: "app",
347
+ * },
348
+ * });
349
+ * ```
350
+ * ### Build targets
351
+ *
352
+ * ```typescript
353
+ * import * as pulumi from "@pulumi/pulumi";
354
+ * import * as docker from "@pulumi/docker";
355
+ *
356
+ * const image = new docker.buildx.Image("image", {
357
+ * context: {
358
+ * location: "app",
359
+ * },
360
+ * targets: [
361
+ * "build-me",
362
+ * "also-build-me",
363
+ * ],
364
+ * });
365
+ * ```
366
+ * ### Named contexts
367
+ *
368
+ * ```typescript
369
+ * import * as pulumi from "@pulumi/pulumi";
370
+ * import * as docker from "@pulumi/docker";
371
+ *
372
+ * const image = new docker.buildx.Image("image", {context: {
373
+ * location: "app",
374
+ * named: {
375
+ * "golang:latest": {
376
+ * location: "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
377
+ * },
378
+ * },
379
+ * }});
380
+ * ```
381
+ * ### Remote context
382
+ *
383
+ * ```typescript
384
+ * import * as pulumi from "@pulumi/pulumi";
385
+ * import * as docker from "@pulumi/docker";
386
+ *
387
+ * const image = new docker.buildx.Image("image", {context: {
388
+ * location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
389
+ * }});
390
+ * ```
391
+ * ### Inline Dockerfile
392
+ *
393
+ * ```typescript
394
+ * import * as pulumi from "@pulumi/pulumi";
395
+ * import * as docker from "@pulumi/docker";
396
+ *
397
+ * const image = new docker.buildx.Image("image", {
398
+ * context: {
399
+ * location: "app",
400
+ * },
401
+ * dockerfile: {
402
+ * inline: `FROM busybox
403
+ * COPY hello.c ./
404
+ * `,
405
+ * },
406
+ * });
407
+ * ```
408
+ * ### Remote context
409
+ *
410
+ * ```typescript
411
+ * import * as pulumi from "@pulumi/pulumi";
412
+ * import * as docker from "@pulumi/docker";
413
+ *
414
+ * const image = new docker.buildx.Image("image", {
415
+ * context: {
416
+ * location: "https://github.com/docker-library/hello-world.git",
417
+ * },
418
+ * dockerfile: {
419
+ * location: "app/Dockerfile",
420
+ * },
421
+ * });
422
+ * ```
423
+ * ### Local export
424
+ *
425
+ * ```typescript
426
+ * import * as pulumi from "@pulumi/pulumi";
427
+ * import * as docker from "@pulumi/docker";
428
+ *
429
+ * const image = new docker.buildx.Image("image", {
430
+ * context: {
431
+ * location: "app",
432
+ * },
433
+ * exports: [{
434
+ * docker: {
435
+ * tar: true,
436
+ * },
437
+ * }],
438
+ * });
439
+ * ```
6
440
  */
7
441
  export declare class Image extends pulumi.CustomResource {
8
442
  /**
@@ -20,75 +454,204 @@ export declare class Image extends pulumi.CustomResource {
20
454
  */
21
455
  static isInstance(obj: any): obj is Image;
22
456
  /**
457
+ * Custom `host:ip` mappings to use during the build.
23
458
  *
24
- * An optional map of named build-time argument variables to set during
25
- * the Docker build. This flag allows you to pass build-time variables that
26
- * can be accessed like environment variables inside the RUN
27
- * instruction.
459
+ * Equivalent to Docker's `--add-host` flag.
460
+ */
461
+ readonly addHosts: pulumi.Output<string[] | undefined>;
462
+ /**
463
+ * `ARG` names and values to set during the build.
464
+ *
465
+ * These variables are accessed like environment variables inside `RUN`
466
+ * instructions.
467
+ *
468
+ * Build arguments are persisted in the image, so you should use `secrets`
469
+ * if these arguments are sensitive.
470
+ *
471
+ * Equivalent to Docker's `--build-arg` flag.
28
472
  */
29
473
  readonly buildArgs: pulumi.Output<{
30
474
  [key: string]: string;
31
475
  } | undefined>;
32
476
  /**
477
+ * By default, preview behavior depends on the execution environment. If
478
+ * Pulumi detects the operation is running on a CI system (GitHub Actions,
479
+ * Travis CI, Azure Pipelines, etc.) then it will build images during
480
+ * previews as a safeguard. Otherwise, if not running on CI, previews will
481
+ * not build images.
482
+ *
483
+ * Setting this to `false` forces previews to never perform builds, and
484
+ * setting it to `true` will always build the image during previews.
485
+ *
486
+ * Images built during previews are never exported to registries, however
487
+ * cache manifests are still exported.
33
488
  *
34
- * When true, attempt to build the image during previews. Outputs are not
35
- * pushed to registries, however caches are still populated.
489
+ * On-disk Dockerfiles are always validated for syntactic correctness
490
+ * regardless of this setting.
36
491
  */
37
492
  readonly buildOnPreview: pulumi.Output<boolean | undefined>;
38
493
  /**
494
+ * Builder configuration.
495
+ */
496
+ readonly builder: pulumi.Output<outputs.buildx.BuilderConfig | undefined>;
497
+ /**
498
+ * Cache export configuration.
499
+ *
500
+ * Equivalent to Docker's `--cache-from` flag.
501
+ */
502
+ readonly cacheFrom: pulumi.Output<outputs.buildx.CacheFromEntry[] | undefined>;
503
+ /**
504
+ * Cache import configuration.
505
+ *
506
+ * Equivalent to Docker's `--cache-to` flag.
507
+ */
508
+ readonly cacheTo: pulumi.Output<outputs.buildx.CacheToEntry[] | undefined>;
509
+ /**
510
+ * Build context settings.
511
+ *
512
+ * Equivalent to Docker's `PATH | URL | -` positional argument.
513
+ */
514
+ readonly context: pulumi.Output<outputs.buildx.BuildContext | undefined>;
515
+ /**
516
+ * A preliminary hash of the image's build context.
517
+ *
518
+ * Pulumi uses this to determine if an image _may_ need to be re-built.
519
+ */
520
+ readonly contextHash: pulumi.Output<string>;
521
+ /**
522
+ * A mapping of target names to the SHA256 digest of their pushed manifest.
523
+ *
524
+ * If no target was specified 'default' is used as the target name.
525
+ *
526
+ * Pushed manifests can be referenced as `<tag>@<digest>`.
527
+ */
528
+ readonly digests: pulumi.Output<{
529
+ [key: string]: string;
530
+ }>;
531
+ /**
532
+ * Dockerfile settings.
39
533
  *
40
- * Build with a specific builder instance
534
+ * Equivalent to Docker's `--file` flag.
41
535
  */
42
- readonly builder: pulumi.Output<string | undefined>;
536
+ readonly dockerfile: pulumi.Output<outputs.buildx.Dockerfile | undefined>;
43
537
  /**
538
+ * Controls where images are persisted after building.
44
539
  *
45
- * External cache sources (e.g., "user/app:cache", "type=local,src=path/to/dir")
540
+ * Images are only stored in the local cache unless `exports` are
541
+ * explicitly configured.
542
+ *
543
+ * Equivalent to Docker's `--output` flag.
46
544
  */
47
- readonly cacheFrom: pulumi.Output<string[] | undefined>;
545
+ readonly exports: pulumi.Output<outputs.buildx.ExportEntry[] | undefined>;
48
546
  /**
547
+ * Attach arbitrary key/value metadata to the image.
49
548
  *
50
- * Cache export destinations (e.g., "user/app:cache", "type=local,dest=path/to/dir")
549
+ * Equivalent to Docker's `--label` flag.
51
550
  */
52
- readonly cacheTo: pulumi.Output<string[] | undefined>;
551
+ readonly labels: pulumi.Output<{
552
+ [key: string]: string;
553
+ } | undefined>;
53
554
  /**
555
+ * When `true` the build will automatically include a `docker` export.
556
+ *
557
+ * Defaults to `false`.
54
558
  *
55
- * Path to use for build context. If omitted, an empty context is used.
559
+ * Equivalent to Docker's `--load` flag.
56
560
  */
57
- readonly context: pulumi.Output<string | undefined>;
58
- readonly contextHash: pulumi.Output<string | undefined>;
561
+ readonly load: pulumi.Output<boolean | undefined>;
59
562
  /**
563
+ * Set the network mode for `RUN` instructions. Defaults to `default`.
564
+ *
565
+ * For custom networks, configure your builder with `--driver-opt network=...`.
60
566
  *
61
- * Name and optionally a tag (format: "name:tag"). If outputting to a
62
- * registry, the name should include the fully qualified registry address.
567
+ * Equivalent to Docker's `--network` flag.
63
568
  */
64
- readonly exports: pulumi.Output<string[] | undefined>;
569
+ readonly network: pulumi.Output<enums.buildx.NetworkMode | undefined>;
65
570
  /**
571
+ * Do not import cache manifests when building the image.
66
572
  *
67
- * Name of the Dockerfile to use (defaults to "${context}/Dockerfile").
573
+ * Equivalent to Docker's `--no-cache` flag.
68
574
  */
69
- readonly file: pulumi.Output<string | undefined>;
70
- readonly manifests: pulumi.Output<outputs.buildx.Manifest[]>;
575
+ readonly noCache: pulumi.Output<boolean | undefined>;
71
576
  /**
577
+ * Set target platform(s) for the build. Defaults to the host's platform.
72
578
  *
73
- * Set target platforms for the build. Defaults to the host's platform
579
+ * Equivalent to Docker's `--platform` flag.
74
580
  */
75
- readonly platforms: pulumi.Output<string[] | undefined>;
581
+ readonly platforms: pulumi.Output<enums.buildx.Platform[] | undefined>;
76
582
  /**
583
+ * Always pull referenced images.
77
584
  *
78
- * Always attempt to pull all referenced images
585
+ * Equivalent to Docker's `--pull` flag.
79
586
  */
80
587
  readonly pull: pulumi.Output<boolean | undefined>;
81
588
  /**
589
+ * When `true` the build will automatically include a `registry` export.
82
590
  *
83
- * Logins for registry outputs
591
+ * Defaults to `false`.
592
+ *
593
+ * Equivalent to Docker's `--push` flag.
594
+ */
595
+ readonly push: pulumi.Output<boolean | undefined>;
596
+ /**
597
+ * If the image was pushed to any registries then this will contain a
598
+ * single fully-qualified tag including the build's digest.
599
+ *
600
+ * This is only for convenience and may not be appropriate for situations
601
+ * where multiple tags or registries are involved. In those cases this
602
+ * output is not guaranteed to be stable.
603
+ *
604
+ * For more control over tags consumed by downstream resources you should
605
+ * use the `Digests` output.
606
+ */
607
+ readonly ref: pulumi.Output<string>;
608
+ /**
609
+ * Registry credentials. Required if reading or exporting to private
610
+ * repositories.
611
+ *
612
+ * Credentials are kept in-memory and do not pollute pre-existing
613
+ * credentials on the host.
614
+ *
615
+ * Similar to `docker login`.
84
616
  */
85
617
  readonly registries: pulumi.Output<outputs.buildx.RegistryAuth[] | undefined>;
86
618
  /**
619
+ * A mapping of secret names to their corresponding values.
620
+ *
621
+ * Unlike the Docker CLI, these can be passed by value and do not need to
622
+ * exist on-disk or in environment variables.
623
+ *
624
+ * Build arguments and environment variables are persistent in the final
625
+ * image, so you should use this for sensitive values.
626
+ *
627
+ * Similar to Docker's `--secret` flag.
628
+ */
629
+ readonly secrets: pulumi.Output<{
630
+ [key: string]: string;
631
+ } | undefined>;
632
+ /**
633
+ * SSH agent socket or keys to expose to the build.
87
634
  *
88
- * Name and optionally a tag (format: "name:tag"). If outputting to a
89
- * registry, the name should include the fully qualified registry address.
635
+ * Equivalent to Docker's `--ssh` flag.
90
636
  */
91
- readonly tags: pulumi.Output<string[]>;
637
+ readonly ssh: pulumi.Output<outputs.buildx.SSH[] | undefined>;
638
+ /**
639
+ * Name and optionally a tag (format: `name:tag`).
640
+ *
641
+ * If exporting to a registry, the name should include the fully qualified
642
+ * registry address (e.g. `docker.io/pulumi/pulumi:latest`).
643
+ *
644
+ * Equivalent to Docker's `--tag` flag.
645
+ */
646
+ readonly tags: pulumi.Output<string[] | undefined>;
647
+ /**
648
+ * Set the target build stage(s) to build.
649
+ *
650
+ * If not specified all targets will be built by default.
651
+ *
652
+ * Equivalent to Docker's `--target` flag.
653
+ */
654
+ readonly targets: pulumi.Output<string[] | undefined>;
92
655
  /**
93
656
  * Create a Image resource with the given unique name, arguments, and options.
94
657
  *
@@ -96,78 +659,181 @@ export declare class Image extends pulumi.CustomResource {
96
659
  * @param args The arguments to use to populate this resource's properties.
97
660
  * @param opts A bag of options that control this resource's behavior.
98
661
  */
99
- constructor(name: string, args: ImageArgs, opts?: pulumi.CustomResourceOptions);
662
+ constructor(name: string, args?: ImageArgs, opts?: pulumi.CustomResourceOptions);
100
663
  }
101
664
  /**
102
665
  * The set of arguments for constructing a Image resource.
103
666
  */
104
667
  export interface ImageArgs {
105
668
  /**
669
+ * Custom `host:ip` mappings to use during the build.
106
670
  *
107
- * An optional map of named build-time argument variables to set during
108
- * the Docker build. This flag allows you to pass build-time variables that
109
- * can be accessed like environment variables inside the RUN
110
- * instruction.
671
+ * Equivalent to Docker's `--add-host` flag.
672
+ */
673
+ addHosts?: pulumi.Input<pulumi.Input<string>[]>;
674
+ /**
675
+ * `ARG` names and values to set during the build.
676
+ *
677
+ * These variables are accessed like environment variables inside `RUN`
678
+ * instructions.
679
+ *
680
+ * Build arguments are persisted in the image, so you should use `secrets`
681
+ * if these arguments are sensitive.
682
+ *
683
+ * Equivalent to Docker's `--build-arg` flag.
111
684
  */
112
685
  buildArgs?: pulumi.Input<{
113
686
  [key: string]: pulumi.Input<string>;
114
687
  }>;
115
688
  /**
689
+ * By default, preview behavior depends on the execution environment. If
690
+ * Pulumi detects the operation is running on a CI system (GitHub Actions,
691
+ * Travis CI, Azure Pipelines, etc.) then it will build images during
692
+ * previews as a safeguard. Otherwise, if not running on CI, previews will
693
+ * not build images.
694
+ *
695
+ * Setting this to `false` forces previews to never perform builds, and
696
+ * setting it to `true` will always build the image during previews.
697
+ *
698
+ * Images built during previews are never exported to registries, however
699
+ * cache manifests are still exported.
116
700
  *
117
- * When true, attempt to build the image during previews. Outputs are not
118
- * pushed to registries, however caches are still populated.
701
+ * On-disk Dockerfiles are always validated for syntactic correctness
702
+ * regardless of this setting.
119
703
  */
120
704
  buildOnPreview?: pulumi.Input<boolean>;
121
705
  /**
706
+ * Builder configuration.
707
+ */
708
+ builder?: pulumi.Input<inputs.buildx.BuilderConfig>;
709
+ /**
710
+ * Cache export configuration.
711
+ *
712
+ * Equivalent to Docker's `--cache-from` flag.
713
+ */
714
+ cacheFrom?: pulumi.Input<pulumi.Input<inputs.buildx.CacheFromEntry>[]>;
715
+ /**
716
+ * Cache import configuration.
122
717
  *
123
- * Build with a specific builder instance
718
+ * Equivalent to Docker's `--cache-to` flag.
124
719
  */
125
- builder?: pulumi.Input<string>;
720
+ cacheTo?: pulumi.Input<pulumi.Input<inputs.buildx.CacheToEntry>[]>;
126
721
  /**
722
+ * Build context settings.
127
723
  *
128
- * External cache sources (e.g., "user/app:cache", "type=local,src=path/to/dir")
724
+ * Equivalent to Docker's `PATH | URL | -` positional argument.
129
725
  */
130
- cacheFrom?: pulumi.Input<pulumi.Input<string>[]>;
726
+ context?: pulumi.Input<inputs.buildx.BuildContext>;
131
727
  /**
728
+ * Dockerfile settings.
132
729
  *
133
- * Cache export destinations (e.g., "user/app:cache", "type=local,dest=path/to/dir")
730
+ * Equivalent to Docker's `--file` flag.
134
731
  */
135
- cacheTo?: pulumi.Input<pulumi.Input<string>[]>;
732
+ dockerfile?: pulumi.Input<inputs.buildx.Dockerfile>;
136
733
  /**
734
+ * Controls where images are persisted after building.
735
+ *
736
+ * Images are only stored in the local cache unless `exports` are
737
+ * explicitly configured.
137
738
  *
138
- * Path to use for build context. If omitted, an empty context is used.
739
+ * Equivalent to Docker's `--output` flag.
139
740
  */
140
- context?: pulumi.Input<string>;
741
+ exports?: pulumi.Input<pulumi.Input<inputs.buildx.ExportEntry>[]>;
141
742
  /**
743
+ * Attach arbitrary key/value metadata to the image.
142
744
  *
143
- * Name and optionally a tag (format: "name:tag"). If outputting to a
144
- * registry, the name should include the fully qualified registry address.
745
+ * Equivalent to Docker's `--label` flag.
145
746
  */
146
- exports?: pulumi.Input<pulumi.Input<string>[]>;
747
+ labels?: pulumi.Input<{
748
+ [key: string]: pulumi.Input<string>;
749
+ }>;
147
750
  /**
751
+ * When `true` the build will automatically include a `docker` export.
752
+ *
753
+ * Defaults to `false`.
148
754
  *
149
- * Name of the Dockerfile to use (defaults to "${context}/Dockerfile").
755
+ * Equivalent to Docker's `--load` flag.
150
756
  */
151
- file?: pulumi.Input<string>;
757
+ load?: pulumi.Input<boolean>;
152
758
  /**
759
+ * Set the network mode for `RUN` instructions. Defaults to `default`.
153
760
  *
154
- * Set target platforms for the build. Defaults to the host's platform
761
+ * For custom networks, configure your builder with `--driver-opt network=...`.
762
+ *
763
+ * Equivalent to Docker's `--network` flag.
155
764
  */
156
- platforms?: pulumi.Input<pulumi.Input<string>[]>;
765
+ network?: pulumi.Input<enums.buildx.NetworkMode>;
157
766
  /**
767
+ * Do not import cache manifests when building the image.
158
768
  *
159
- * Always attempt to pull all referenced images
769
+ * Equivalent to Docker's `--no-cache` flag.
770
+ */
771
+ noCache?: pulumi.Input<boolean>;
772
+ /**
773
+ * Set target platform(s) for the build. Defaults to the host's platform.
774
+ *
775
+ * Equivalent to Docker's `--platform` flag.
776
+ */
777
+ platforms?: pulumi.Input<pulumi.Input<enums.buildx.Platform>[]>;
778
+ /**
779
+ * Always pull referenced images.
780
+ *
781
+ * Equivalent to Docker's `--pull` flag.
160
782
  */
161
783
  pull?: pulumi.Input<boolean>;
162
784
  /**
785
+ * When `true` the build will automatically include a `registry` export.
786
+ *
787
+ * Defaults to `false`.
788
+ *
789
+ * Equivalent to Docker's `--push` flag.
790
+ */
791
+ push?: pulumi.Input<boolean>;
792
+ /**
793
+ * Registry credentials. Required if reading or exporting to private
794
+ * repositories.
795
+ *
796
+ * Credentials are kept in-memory and do not pollute pre-existing
797
+ * credentials on the host.
163
798
  *
164
- * Logins for registry outputs
799
+ * Similar to `docker login`.
165
800
  */
166
801
  registries?: pulumi.Input<pulumi.Input<inputs.buildx.RegistryAuth>[]>;
167
802
  /**
803
+ * A mapping of secret names to their corresponding values.
804
+ *
805
+ * Unlike the Docker CLI, these can be passed by value and do not need to
806
+ * exist on-disk or in environment variables.
807
+ *
808
+ * Build arguments and environment variables are persistent in the final
809
+ * image, so you should use this for sensitive values.
810
+ *
811
+ * Similar to Docker's `--secret` flag.
812
+ */
813
+ secrets?: pulumi.Input<{
814
+ [key: string]: pulumi.Input<string>;
815
+ }>;
816
+ /**
817
+ * SSH agent socket or keys to expose to the build.
818
+ *
819
+ * Equivalent to Docker's `--ssh` flag.
820
+ */
821
+ ssh?: pulumi.Input<pulumi.Input<inputs.buildx.SSH>[]>;
822
+ /**
823
+ * Name and optionally a tag (format: `name:tag`).
824
+ *
825
+ * If exporting to a registry, the name should include the fully qualified
826
+ * registry address (e.g. `docker.io/pulumi/pulumi:latest`).
827
+ *
828
+ * Equivalent to Docker's `--tag` flag.
829
+ */
830
+ tags?: pulumi.Input<pulumi.Input<string>[]>;
831
+ /**
832
+ * Set the target build stage(s) to build.
833
+ *
834
+ * If not specified all targets will be built by default.
168
835
  *
169
- * Name and optionally a tag (format: "name:tag"). If outputting to a
170
- * registry, the name should include the fully qualified registry address.
836
+ * Equivalent to Docker's `--target` flag.
171
837
  */
172
- tags: pulumi.Input<pulumi.Input<string>[]>;
838
+ targets?: pulumi.Input<pulumi.Input<string>[]>;
173
839
  }