pulumi-docker-build 0.0.1__py3-none-any.whl

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.

Potentially problematic release.


This version of pulumi-docker-build might be problematic. Click here for more details.

@@ -0,0 +1,1774 @@
1
+ # coding=utf-8
2
+ # *** WARNING: this file was generated by pulumi-language-python. ***
3
+ # *** Do not edit by hand unless you're certain you know what you are doing! ***
4
+
5
+ import copy
6
+ import warnings
7
+ import pulumi
8
+ import pulumi.runtime
9
+ from typing import Any, Mapping, Optional, Sequence, Union, overload
10
+ from . import _utilities
11
+ from . import outputs
12
+ from ._enums import *
13
+ from ._inputs import *
14
+
15
+ __all__ = ['ImageArgs', 'Image']
16
+
17
+ @pulumi.input_type
18
+ class ImageArgs:
19
+ def __init__(__self__, *,
20
+ add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
21
+ build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
22
+ build_on_preview: Optional[pulumi.Input[bool]] = None,
23
+ builder: Optional[pulumi.Input['BuilderConfigArgs']] = None,
24
+ cache_from: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]] = None,
25
+ cache_to: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]] = None,
26
+ context: Optional[pulumi.Input['BuildContextArgs']] = None,
27
+ dockerfile: Optional[pulumi.Input['DockerfileArgs']] = None,
28
+ exec_: Optional[pulumi.Input[bool]] = None,
29
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]] = None,
30
+ labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
31
+ load: Optional[pulumi.Input[bool]] = None,
32
+ network: Optional[pulumi.Input['NetworkMode']] = None,
33
+ no_cache: Optional[pulumi.Input[bool]] = None,
34
+ platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None,
35
+ pull: Optional[pulumi.Input[bool]] = None,
36
+ push: Optional[pulumi.Input[bool]] = None,
37
+ registries: Optional[pulumi.Input[Sequence[pulumi.Input['RegistryArgs']]]] = None,
38
+ secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
39
+ ssh: Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]] = None,
40
+ tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
41
+ target: Optional[pulumi.Input[str]] = None):
42
+ """
43
+ The set of arguments for constructing a Image resource.
44
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] add_hosts: Custom `host:ip` mappings to use during the build.
45
+
46
+ Equivalent to Docker's `--add-host` flag.
47
+ :param pulumi.Input[Mapping[str, pulumi.Input[str]]] build_args: `ARG` names and values to set during the build.
48
+
49
+ These variables are accessed like environment variables inside `RUN`
50
+ instructions.
51
+
52
+ Build arguments are persisted in the image, so you should use `secrets`
53
+ if these arguments are sensitive.
54
+
55
+ Equivalent to Docker's `--build-arg` flag.
56
+ :param pulumi.Input[bool] build_on_preview: Setting this to `false` will always skip image builds during previews,
57
+ and setting it to `true` will always build images during previews.
58
+
59
+ Images built during previews are never exported to registries, however
60
+ cache manifests are still exported.
61
+
62
+ On-disk Dockerfiles are always validated for syntactic correctness
63
+ regardless of this setting.
64
+
65
+ Defaults to `true` as a safeguard against broken images merging as part
66
+ of CI pipelines.
67
+ :param pulumi.Input['BuilderConfigArgs'] builder: Builder configuration.
68
+ :param pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]] cache_from: Cache export configuration.
69
+
70
+ Equivalent to Docker's `--cache-from` flag.
71
+ :param pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]] cache_to: Cache import configuration.
72
+
73
+ Equivalent to Docker's `--cache-to` flag.
74
+ :param pulumi.Input['BuildContextArgs'] context: Build context settings.
75
+
76
+ Equivalent to Docker's `PATH | URL | -` positional argument.
77
+ :param pulumi.Input['DockerfileArgs'] dockerfile: Dockerfile settings.
78
+
79
+ Equivalent to Docker's `--file` flag.
80
+ :param pulumi.Input[bool] exec_: Use `exec` mode to build this image.
81
+
82
+ By default the provider embeds a v25 Docker client with v0.12 buildx
83
+ support. This helps ensure consistent behavior across environments and
84
+ is compatible with alternative build backends (e.g. `buildkitd`), but
85
+ it may not be desirable if you require a specific version of buildx.
86
+ For example you may want to run a custom `docker-buildx` binary with
87
+ support for [Docker Build
88
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
89
+
90
+ When this is set to `true` the provider will instead execute the
91
+ `docker-buildx` binary directly to perform its operations. The user is
92
+ responsible for ensuring this binary exists, with correct permissions
93
+ and pre-configured builders, at a path Docker expects (e.g.
94
+ `~/.docker/cli-plugins`).
95
+
96
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
97
+ to surface fine-grained errors and warnings. Additionally credentials
98
+ are temporarily written to disk in order to provide them to the
99
+ `docker-buildx` binary.
100
+ :param pulumi.Input[Sequence[pulumi.Input['ExportArgs']]] exports: Controls where images are persisted after building.
101
+
102
+ Images are only stored in the local cache unless `exports` are
103
+ explicitly configured.
104
+
105
+ Exporting to multiple destinations requires a daemon running BuildKit
106
+ 0.13 or later.
107
+
108
+ Equivalent to Docker's `--output` flag.
109
+ :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image.
110
+
111
+ Equivalent to Docker's `--label` flag.
112
+ :param pulumi.Input[bool] load: When `true` the build will automatically include a `docker` export.
113
+
114
+ Defaults to `false`.
115
+
116
+ Equivalent to Docker's `--load` flag.
117
+ :param pulumi.Input['NetworkMode'] network: Set the network mode for `RUN` instructions. Defaults to `default`.
118
+
119
+ For custom networks, configure your builder with `--driver-opt network=...`.
120
+
121
+ Equivalent to Docker's `--network` flag.
122
+ :param pulumi.Input[bool] no_cache: Do not import cache manifests when building the image.
123
+
124
+ Equivalent to Docker's `--no-cache` flag.
125
+ :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform.
126
+
127
+ Equivalent to Docker's `--platform` flag.
128
+ :param pulumi.Input[bool] pull: Always pull referenced images.
129
+
130
+ Equivalent to Docker's `--pull` flag.
131
+ :param pulumi.Input[bool] push: When `true` the build will automatically include a `registry` export.
132
+
133
+ Defaults to `false`.
134
+
135
+ Equivalent to Docker's `--push` flag.
136
+ :param pulumi.Input[Sequence[pulumi.Input['RegistryArgs']]] registries: Registry credentials. Required if reading or exporting to private
137
+ repositories.
138
+
139
+ Credentials are kept in-memory and do not pollute pre-existing
140
+ credentials on the host.
141
+
142
+ Similar to `docker login`.
143
+ :param pulumi.Input[Mapping[str, pulumi.Input[str]]] secrets: A mapping of secret names to their corresponding values.
144
+
145
+ Unlike the Docker CLI, these can be passed by value and do not need to
146
+ exist on-disk or in environment variables.
147
+
148
+ Build arguments and environment variables are persistent in the final
149
+ image, so you should use this for sensitive values.
150
+
151
+ Similar to Docker's `--secret` flag.
152
+ :param pulumi.Input[Sequence[pulumi.Input['SSHArgs']]] ssh: SSH agent socket or keys to expose to the build.
153
+
154
+ Equivalent to Docker's `--ssh` flag.
155
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] tags: Name and optionally a tag (format: `name:tag`).
156
+
157
+ If exporting to a registry, the name should include the fully qualified
158
+ registry address (e.g. `docker.io/pulumi/pulumi:latest`).
159
+
160
+ Equivalent to Docker's `--tag` flag.
161
+ :param pulumi.Input[str] target: Set the target build stage(s) to build.
162
+
163
+ If not specified all targets will be built by default.
164
+
165
+ Equivalent to Docker's `--target` flag.
166
+ """
167
+ if add_hosts is not None:
168
+ pulumi.set(__self__, "add_hosts", add_hosts)
169
+ if build_args is not None:
170
+ pulumi.set(__self__, "build_args", build_args)
171
+ if build_on_preview is None:
172
+ build_on_preview = True
173
+ if build_on_preview is not None:
174
+ pulumi.set(__self__, "build_on_preview", build_on_preview)
175
+ if builder is not None:
176
+ pulumi.set(__self__, "builder", builder)
177
+ if cache_from is not None:
178
+ pulumi.set(__self__, "cache_from", cache_from)
179
+ if cache_to is not None:
180
+ pulumi.set(__self__, "cache_to", cache_to)
181
+ if context is not None:
182
+ pulumi.set(__self__, "context", context)
183
+ if dockerfile is not None:
184
+ pulumi.set(__self__, "dockerfile", dockerfile)
185
+ if exec_ is not None:
186
+ pulumi.set(__self__, "exec_", exec_)
187
+ if exports is not None:
188
+ pulumi.set(__self__, "exports", exports)
189
+ if labels is not None:
190
+ pulumi.set(__self__, "labels", labels)
191
+ if load is not None:
192
+ pulumi.set(__self__, "load", load)
193
+ if network is None:
194
+ network = 'default'
195
+ if network is not None:
196
+ pulumi.set(__self__, "network", network)
197
+ if no_cache is not None:
198
+ pulumi.set(__self__, "no_cache", no_cache)
199
+ if platforms is not None:
200
+ pulumi.set(__self__, "platforms", platforms)
201
+ if pull is not None:
202
+ pulumi.set(__self__, "pull", pull)
203
+ if push is not None:
204
+ pulumi.set(__self__, "push", push)
205
+ if registries is not None:
206
+ pulumi.set(__self__, "registries", registries)
207
+ if secrets is not None:
208
+ pulumi.set(__self__, "secrets", secrets)
209
+ if ssh is not None:
210
+ pulumi.set(__self__, "ssh", ssh)
211
+ if tags is not None:
212
+ pulumi.set(__self__, "tags", tags)
213
+ if target is not None:
214
+ pulumi.set(__self__, "target", target)
215
+
216
+ @property
217
+ @pulumi.getter(name="addHosts")
218
+ def add_hosts(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
219
+ """
220
+ Custom `host:ip` mappings to use during the build.
221
+
222
+ Equivalent to Docker's `--add-host` flag.
223
+ """
224
+ return pulumi.get(self, "add_hosts")
225
+
226
+ @add_hosts.setter
227
+ def add_hosts(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
228
+ pulumi.set(self, "add_hosts", value)
229
+
230
+ @property
231
+ @pulumi.getter(name="buildArgs")
232
+ def build_args(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
233
+ """
234
+ `ARG` names and values to set during the build.
235
+
236
+ These variables are accessed like environment variables inside `RUN`
237
+ instructions.
238
+
239
+ Build arguments are persisted in the image, so you should use `secrets`
240
+ if these arguments are sensitive.
241
+
242
+ Equivalent to Docker's `--build-arg` flag.
243
+ """
244
+ return pulumi.get(self, "build_args")
245
+
246
+ @build_args.setter
247
+ def build_args(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
248
+ pulumi.set(self, "build_args", value)
249
+
250
+ @property
251
+ @pulumi.getter(name="buildOnPreview")
252
+ def build_on_preview(self) -> Optional[pulumi.Input[bool]]:
253
+ """
254
+ Setting this to `false` will always skip image builds during previews,
255
+ and setting it to `true` will always build images during previews.
256
+
257
+ Images built during previews are never exported to registries, however
258
+ cache manifests are still exported.
259
+
260
+ On-disk Dockerfiles are always validated for syntactic correctness
261
+ regardless of this setting.
262
+
263
+ Defaults to `true` as a safeguard against broken images merging as part
264
+ of CI pipelines.
265
+ """
266
+ return pulumi.get(self, "build_on_preview")
267
+
268
+ @build_on_preview.setter
269
+ def build_on_preview(self, value: Optional[pulumi.Input[bool]]):
270
+ pulumi.set(self, "build_on_preview", value)
271
+
272
+ @property
273
+ @pulumi.getter
274
+ def builder(self) -> Optional[pulumi.Input['BuilderConfigArgs']]:
275
+ """
276
+ Builder configuration.
277
+ """
278
+ return pulumi.get(self, "builder")
279
+
280
+ @builder.setter
281
+ def builder(self, value: Optional[pulumi.Input['BuilderConfigArgs']]):
282
+ pulumi.set(self, "builder", value)
283
+
284
+ @property
285
+ @pulumi.getter(name="cacheFrom")
286
+ def cache_from(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]]:
287
+ """
288
+ Cache export configuration.
289
+
290
+ Equivalent to Docker's `--cache-from` flag.
291
+ """
292
+ return pulumi.get(self, "cache_from")
293
+
294
+ @cache_from.setter
295
+ def cache_from(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]]):
296
+ pulumi.set(self, "cache_from", value)
297
+
298
+ @property
299
+ @pulumi.getter(name="cacheTo")
300
+ def cache_to(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]]:
301
+ """
302
+ Cache import configuration.
303
+
304
+ Equivalent to Docker's `--cache-to` flag.
305
+ """
306
+ return pulumi.get(self, "cache_to")
307
+
308
+ @cache_to.setter
309
+ def cache_to(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]]):
310
+ pulumi.set(self, "cache_to", value)
311
+
312
+ @property
313
+ @pulumi.getter
314
+ def context(self) -> Optional[pulumi.Input['BuildContextArgs']]:
315
+ """
316
+ Build context settings.
317
+
318
+ Equivalent to Docker's `PATH | URL | -` positional argument.
319
+ """
320
+ return pulumi.get(self, "context")
321
+
322
+ @context.setter
323
+ def context(self, value: Optional[pulumi.Input['BuildContextArgs']]):
324
+ pulumi.set(self, "context", value)
325
+
326
+ @property
327
+ @pulumi.getter
328
+ def dockerfile(self) -> Optional[pulumi.Input['DockerfileArgs']]:
329
+ """
330
+ Dockerfile settings.
331
+
332
+ Equivalent to Docker's `--file` flag.
333
+ """
334
+ return pulumi.get(self, "dockerfile")
335
+
336
+ @dockerfile.setter
337
+ def dockerfile(self, value: Optional[pulumi.Input['DockerfileArgs']]):
338
+ pulumi.set(self, "dockerfile", value)
339
+
340
+ @property
341
+ @pulumi.getter(name="exec")
342
+ def exec_(self) -> Optional[pulumi.Input[bool]]:
343
+ """
344
+ Use `exec` mode to build this image.
345
+
346
+ By default the provider embeds a v25 Docker client with v0.12 buildx
347
+ support. This helps ensure consistent behavior across environments and
348
+ is compatible with alternative build backends (e.g. `buildkitd`), but
349
+ it may not be desirable if you require a specific version of buildx.
350
+ For example you may want to run a custom `docker-buildx` binary with
351
+ support for [Docker Build
352
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
353
+
354
+ When this is set to `true` the provider will instead execute the
355
+ `docker-buildx` binary directly to perform its operations. The user is
356
+ responsible for ensuring this binary exists, with correct permissions
357
+ and pre-configured builders, at a path Docker expects (e.g.
358
+ `~/.docker/cli-plugins`).
359
+
360
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
361
+ to surface fine-grained errors and warnings. Additionally credentials
362
+ are temporarily written to disk in order to provide them to the
363
+ `docker-buildx` binary.
364
+ """
365
+ return pulumi.get(self, "exec_")
366
+
367
+ @exec_.setter
368
+ def exec_(self, value: Optional[pulumi.Input[bool]]):
369
+ pulumi.set(self, "exec_", value)
370
+
371
+ @property
372
+ @pulumi.getter
373
+ def exports(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]]:
374
+ """
375
+ Controls where images are persisted after building.
376
+
377
+ Images are only stored in the local cache unless `exports` are
378
+ explicitly configured.
379
+
380
+ Exporting to multiple destinations requires a daemon running BuildKit
381
+ 0.13 or later.
382
+
383
+ Equivalent to Docker's `--output` flag.
384
+ """
385
+ return pulumi.get(self, "exports")
386
+
387
+ @exports.setter
388
+ def exports(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]]):
389
+ pulumi.set(self, "exports", value)
390
+
391
+ @property
392
+ @pulumi.getter
393
+ def labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
394
+ """
395
+ Attach arbitrary key/value metadata to the image.
396
+
397
+ Equivalent to Docker's `--label` flag.
398
+ """
399
+ return pulumi.get(self, "labels")
400
+
401
+ @labels.setter
402
+ def labels(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
403
+ pulumi.set(self, "labels", value)
404
+
405
+ @property
406
+ @pulumi.getter
407
+ def load(self) -> Optional[pulumi.Input[bool]]:
408
+ """
409
+ When `true` the build will automatically include a `docker` export.
410
+
411
+ Defaults to `false`.
412
+
413
+ Equivalent to Docker's `--load` flag.
414
+ """
415
+ return pulumi.get(self, "load")
416
+
417
+ @load.setter
418
+ def load(self, value: Optional[pulumi.Input[bool]]):
419
+ pulumi.set(self, "load", value)
420
+
421
+ @property
422
+ @pulumi.getter
423
+ def network(self) -> Optional[pulumi.Input['NetworkMode']]:
424
+ """
425
+ Set the network mode for `RUN` instructions. Defaults to `default`.
426
+
427
+ For custom networks, configure your builder with `--driver-opt network=...`.
428
+
429
+ Equivalent to Docker's `--network` flag.
430
+ """
431
+ return pulumi.get(self, "network")
432
+
433
+ @network.setter
434
+ def network(self, value: Optional[pulumi.Input['NetworkMode']]):
435
+ pulumi.set(self, "network", value)
436
+
437
+ @property
438
+ @pulumi.getter(name="noCache")
439
+ def no_cache(self) -> Optional[pulumi.Input[bool]]:
440
+ """
441
+ Do not import cache manifests when building the image.
442
+
443
+ Equivalent to Docker's `--no-cache` flag.
444
+ """
445
+ return pulumi.get(self, "no_cache")
446
+
447
+ @no_cache.setter
448
+ def no_cache(self, value: Optional[pulumi.Input[bool]]):
449
+ pulumi.set(self, "no_cache", value)
450
+
451
+ @property
452
+ @pulumi.getter
453
+ def platforms(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]]:
454
+ """
455
+ Set target platform(s) for the build. Defaults to the host's platform.
456
+
457
+ Equivalent to Docker's `--platform` flag.
458
+ """
459
+ return pulumi.get(self, "platforms")
460
+
461
+ @platforms.setter
462
+ def platforms(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]]):
463
+ pulumi.set(self, "platforms", value)
464
+
465
+ @property
466
+ @pulumi.getter
467
+ def pull(self) -> Optional[pulumi.Input[bool]]:
468
+ """
469
+ Always pull referenced images.
470
+
471
+ Equivalent to Docker's `--pull` flag.
472
+ """
473
+ return pulumi.get(self, "pull")
474
+
475
+ @pull.setter
476
+ def pull(self, value: Optional[pulumi.Input[bool]]):
477
+ pulumi.set(self, "pull", value)
478
+
479
+ @property
480
+ @pulumi.getter
481
+ def push(self) -> Optional[pulumi.Input[bool]]:
482
+ """
483
+ When `true` the build will automatically include a `registry` export.
484
+
485
+ Defaults to `false`.
486
+
487
+ Equivalent to Docker's `--push` flag.
488
+ """
489
+ return pulumi.get(self, "push")
490
+
491
+ @push.setter
492
+ def push(self, value: Optional[pulumi.Input[bool]]):
493
+ pulumi.set(self, "push", value)
494
+
495
+ @property
496
+ @pulumi.getter
497
+ def registries(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['RegistryArgs']]]]:
498
+ """
499
+ Registry credentials. Required if reading or exporting to private
500
+ repositories.
501
+
502
+ Credentials are kept in-memory and do not pollute pre-existing
503
+ credentials on the host.
504
+
505
+ Similar to `docker login`.
506
+ """
507
+ return pulumi.get(self, "registries")
508
+
509
+ @registries.setter
510
+ def registries(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['RegistryArgs']]]]):
511
+ pulumi.set(self, "registries", value)
512
+
513
+ @property
514
+ @pulumi.getter
515
+ def secrets(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
516
+ """
517
+ A mapping of secret names to their corresponding values.
518
+
519
+ Unlike the Docker CLI, these can be passed by value and do not need to
520
+ exist on-disk or in environment variables.
521
+
522
+ Build arguments and environment variables are persistent in the final
523
+ image, so you should use this for sensitive values.
524
+
525
+ Similar to Docker's `--secret` flag.
526
+ """
527
+ return pulumi.get(self, "secrets")
528
+
529
+ @secrets.setter
530
+ def secrets(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
531
+ pulumi.set(self, "secrets", value)
532
+
533
+ @property
534
+ @pulumi.getter
535
+ def ssh(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]]:
536
+ """
537
+ SSH agent socket or keys to expose to the build.
538
+
539
+ Equivalent to Docker's `--ssh` flag.
540
+ """
541
+ return pulumi.get(self, "ssh")
542
+
543
+ @ssh.setter
544
+ def ssh(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]]):
545
+ pulumi.set(self, "ssh", value)
546
+
547
+ @property
548
+ @pulumi.getter
549
+ def tags(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
550
+ """
551
+ Name and optionally a tag (format: `name:tag`).
552
+
553
+ If exporting to a registry, the name should include the fully qualified
554
+ registry address (e.g. `docker.io/pulumi/pulumi:latest`).
555
+
556
+ Equivalent to Docker's `--tag` flag.
557
+ """
558
+ return pulumi.get(self, "tags")
559
+
560
+ @tags.setter
561
+ def tags(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
562
+ pulumi.set(self, "tags", value)
563
+
564
+ @property
565
+ @pulumi.getter
566
+ def target(self) -> Optional[pulumi.Input[str]]:
567
+ """
568
+ Set the target build stage(s) to build.
569
+
570
+ If not specified all targets will be built by default.
571
+
572
+ Equivalent to Docker's `--target` flag.
573
+ """
574
+ return pulumi.get(self, "target")
575
+
576
+ @target.setter
577
+ def target(self, value: Optional[pulumi.Input[str]]):
578
+ pulumi.set(self, "target", value)
579
+
580
+
581
+ class Image(pulumi.CustomResource):
582
+ @overload
583
+ def __init__(__self__,
584
+ resource_name: str,
585
+ opts: Optional[pulumi.ResourceOptions] = None,
586
+ add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
587
+ build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
588
+ build_on_preview: Optional[pulumi.Input[bool]] = None,
589
+ builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None,
590
+ cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]]] = None,
591
+ cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]]] = None,
592
+ context: Optional[pulumi.Input[pulumi.InputType['BuildContextArgs']]] = None,
593
+ dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None,
594
+ exec_: Optional[pulumi.Input[bool]] = None,
595
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]]] = None,
596
+ labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
597
+ load: Optional[pulumi.Input[bool]] = None,
598
+ network: Optional[pulumi.Input['NetworkMode']] = None,
599
+ no_cache: Optional[pulumi.Input[bool]] = None,
600
+ platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None,
601
+ pull: Optional[pulumi.Input[bool]] = None,
602
+ push: Optional[pulumi.Input[bool]] = None,
603
+ registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryArgs']]]]] = None,
604
+ secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
605
+ ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None,
606
+ tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
607
+ target: Optional[pulumi.Input[str]] = None,
608
+ __props__=None):
609
+ """
610
+ A Docker image built using buildx -- Docker's interface to the improved
611
+ BuildKit backend.
612
+
613
+ ## Stability
614
+
615
+ **This resource is pre-1.0 and in public preview.**
616
+
617
+ We will strive to keep APIs and behavior as stable as possible, but we
618
+ cannot guarantee stability until version 1.0.
619
+
620
+ ## Migrating Pulumi Docker v3 and v4 Image resources
621
+
622
+ This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
623
+ Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
624
+
625
+ ### Behavioral differences
626
+
627
+ There are several key behavioral differences to keep in mind when transitioning images to the new `Image` resource.
628
+
629
+ #### Previews
630
+
631
+ Version `3.x` of the Pulumi Docker provider always builds images during preview operations.
632
+ 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.
633
+
634
+ Version `4.x` changed build-on-preview behavior to be opt-in.
635
+ By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
636
+ Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
637
+
638
+ The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
639
+ This behavior can be changed by specifying `buildOnPreview`.
640
+
641
+ #### Push behavior
642
+
643
+ Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
644
+ They expose a `skipPush: true` option to disable pushing.
645
+
646
+ This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
647
+
648
+ 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`).
649
+ 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.
650
+
651
+ #### Secrets
652
+
653
+ Version `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field.
654
+
655
+ Version `4.x` of the Pulumi Docker provider does not support secrets.
656
+
657
+ The `Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
658
+ Instead, they should be passed directly as values.
659
+ (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
660
+ Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
661
+
662
+ #### Caching
663
+
664
+ Version `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`.
665
+ It builds targets individually and pushes them to separate images for caching.
666
+
667
+ Version `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches.
668
+
669
+ Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
670
+ This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
671
+
672
+ The `Image` resource delegates all caching behavior to Docker.
673
+ `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.
674
+
675
+ #### Outputs
676
+
677
+ Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest.
678
+ In `4.x` this could also be a single sha256 hash if the image wasn't pushed.
679
+
680
+ Unlike earlier providers the `Image` resource can push multiple tags.
681
+ As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed.
682
+ If multiple tags were pushed this uses one at random.
683
+
684
+ If you need more control over tag references you can use the `digest` output, which is always a single sha256 hash as long as the image was exported somewhere.
685
+
686
+ #### Tag deletion and refreshes
687
+
688
+ 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.
689
+
690
+ The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
691
+ If any are missing a subsequent `update` will push them.
692
+
693
+ When a `Image` is deleted, it will _attempt_ to also delete any pushed tags.
694
+ Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular).
695
+ Manifests are _not_ deleted in the same way during updates -- to do so safely would require a full build to determine whether a Pulumi operation should be an update or update-replace.
696
+
697
+ Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
698
+
699
+ ### Example migration
700
+
701
+ Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `Image` resource showing how they would look after migration.
702
+
703
+ The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
704
+ After migration, the environment variable is no longer needed and CLI flags are now properties on the `Image`.
705
+ In almost all cases, properties of `Image` are named after the Docker CLI flag they correspond to.
706
+
707
+ The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
708
+ It it is shown with parameters similar to the `v3` example for completeness.
709
+
710
+ ## Example Usage
711
+
712
+ ## Example Usage
713
+ ### Push to AWS ECR with caching
714
+ ```python
715
+ import pulumi
716
+ import pulumi_aws as aws
717
+ import pulumi_docker_build as docker_build
718
+
719
+ ecr_repository = aws.ecr.Repository("ecr-repository")
720
+ auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
721
+ my_image = docker_build.Image("my-image",
722
+ cache_from=[docker_build.CacheFromArgs(
723
+ registry=docker_build.CacheFromRegistryArgs(
724
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
725
+ ),
726
+ )],
727
+ cache_to=[docker_build.CacheToArgs(
728
+ registry=docker_build.CacheToRegistryArgs(
729
+ image_manifest=True,
730
+ oci_media_types=True,
731
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
732
+ ),
733
+ )],
734
+ context=docker_build.BuildContextArgs(
735
+ location="./app",
736
+ ),
737
+ push=True,
738
+ registries=[docker_build.RegistryArgs(
739
+ address=ecr_repository.repository_url,
740
+ password=auth_token.password,
741
+ username=auth_token.user_name,
742
+ )],
743
+ tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
744
+ pulumi.export("ref", my_image.ref)
745
+ ```
746
+ ### Multi-platform image
747
+ ```python
748
+ import pulumi
749
+ import pulumi_docker_build as docker_build
750
+
751
+ image = docker_build.Image("image",
752
+ context=docker_build.BuildContextArgs(
753
+ location="app",
754
+ ),
755
+ platforms=[
756
+ docker_build.Platform.PLAN9_AMD64,
757
+ docker_build.Platform.PLAN9_386,
758
+ ])
759
+ ```
760
+ ### Registry export
761
+ ```python
762
+ import pulumi
763
+ import pulumi_docker_build as docker_build
764
+
765
+ image = docker_build.Image("image",
766
+ context=docker_build.BuildContextArgs(
767
+ location="app",
768
+ ),
769
+ push=True,
770
+ registries=[docker_build.RegistryArgs(
771
+ address="docker.io",
772
+ password=docker_hub_password,
773
+ username="pulumibot",
774
+ )],
775
+ tags=["docker.io/pulumi/pulumi:3.107.0"])
776
+ pulumi.export("ref", my_image["ref"])
777
+ ```
778
+ ### Caching
779
+ ```python
780
+ import pulumi
781
+ import pulumi_docker_build as docker_build
782
+
783
+ image = docker_build.Image("image",
784
+ cache_from=[docker_build.CacheFromArgs(
785
+ local=docker_build.CacheFromLocalArgs(
786
+ src="tmp/cache",
787
+ ),
788
+ )],
789
+ cache_to=[docker_build.CacheToArgs(
790
+ local=docker_build.CacheToLocalArgs(
791
+ dest="tmp/cache",
792
+ mode=docker_build.CacheMode.MAX,
793
+ ),
794
+ )],
795
+ context=docker_build.BuildContextArgs(
796
+ location="app",
797
+ ))
798
+ ```
799
+ ### Docker Build Cloud
800
+ ```python
801
+ import pulumi
802
+ import pulumi_docker_build as docker_build
803
+
804
+ image = docker_build.Image("image",
805
+ builder=docker_build.BuilderConfigArgs(
806
+ name="cloud-builder-name",
807
+ ),
808
+ context=docker_build.BuildContextArgs(
809
+ location="app",
810
+ ),
811
+ exec_=True)
812
+ ```
813
+ ### Build arguments
814
+ ```python
815
+ import pulumi
816
+ import pulumi_docker_build as docker_build
817
+
818
+ image = docker_build.Image("image",
819
+ build_args={
820
+ "SET_ME_TO_TRUE": "true",
821
+ },
822
+ context=docker_build.BuildContextArgs(
823
+ location="app",
824
+ ))
825
+ ```
826
+ ### Build target
827
+ ```python
828
+ import pulumi
829
+ import pulumi_docker_build as docker_build
830
+
831
+ image = docker_build.Image("image",
832
+ context=docker_build.BuildContextArgs(
833
+ location="app",
834
+ ),
835
+ target="build-me")
836
+ ```
837
+ ### Named contexts
838
+ ```python
839
+ import pulumi
840
+ import pulumi_docker_build as docker_build
841
+
842
+ image = docker_build.Image("image", context=docker_build.BuildContextArgs(
843
+ location="app",
844
+ named={
845
+ "golang:latest": docker_build.ContextArgs(
846
+ location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
847
+ ),
848
+ },
849
+ ))
850
+ ```
851
+ ### Remote context
852
+ ```python
853
+ import pulumi
854
+ import pulumi_docker_build as docker_build
855
+
856
+ image = docker_build.Image("image", context=docker_build.BuildContextArgs(
857
+ location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
858
+ ))
859
+ ```
860
+ ### Inline Dockerfile
861
+ ```python
862
+ import pulumi
863
+ import pulumi_docker_build as docker_build
864
+
865
+ image = docker_build.Image("image",
866
+ context=docker_build.BuildContextArgs(
867
+ location="app",
868
+ ),
869
+ dockerfile=docker_build.DockerfileArgs(
870
+ inline=\"\"\"FROM busybox
871
+ COPY hello.c ./
872
+ \"\"\",
873
+ ))
874
+ ```
875
+ ### Remote context
876
+ ```python
877
+ import pulumi
878
+ import pulumi_docker_build as docker_build
879
+
880
+ image = docker_build.Image("image",
881
+ context=docker_build.BuildContextArgs(
882
+ location="https://github.com/docker-library/hello-world.git",
883
+ ),
884
+ dockerfile=docker_build.DockerfileArgs(
885
+ location="app/Dockerfile",
886
+ ))
887
+ ```
888
+ ### Local export
889
+ ```python
890
+ import pulumi
891
+ import pulumi_docker_build as docker_build
892
+
893
+ image = docker_build.Image("image",
894
+ context=docker_build.BuildContextArgs(
895
+ location="app",
896
+ ),
897
+ exports=[docker_build.ExportArgs(
898
+ docker=docker_build.ExportDockerArgs(
899
+ tar=True,
900
+ ),
901
+ )])
902
+ ```
903
+
904
+ :param str resource_name: The name of the resource.
905
+ :param pulumi.ResourceOptions opts: Options for the resource.
906
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] add_hosts: Custom `host:ip` mappings to use during the build.
907
+
908
+ Equivalent to Docker's `--add-host` flag.
909
+ :param pulumi.Input[Mapping[str, pulumi.Input[str]]] build_args: `ARG` names and values to set during the build.
910
+
911
+ These variables are accessed like environment variables inside `RUN`
912
+ instructions.
913
+
914
+ Build arguments are persisted in the image, so you should use `secrets`
915
+ if these arguments are sensitive.
916
+
917
+ Equivalent to Docker's `--build-arg` flag.
918
+ :param pulumi.Input[bool] build_on_preview: Setting this to `false` will always skip image builds during previews,
919
+ and setting it to `true` will always build images during previews.
920
+
921
+ Images built during previews are never exported to registries, however
922
+ cache manifests are still exported.
923
+
924
+ On-disk Dockerfiles are always validated for syntactic correctness
925
+ regardless of this setting.
926
+
927
+ Defaults to `true` as a safeguard against broken images merging as part
928
+ of CI pipelines.
929
+ :param pulumi.Input[pulumi.InputType['BuilderConfigArgs']] builder: Builder configuration.
930
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]] cache_from: Cache export configuration.
931
+
932
+ Equivalent to Docker's `--cache-from` flag.
933
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]] cache_to: Cache import configuration.
934
+
935
+ Equivalent to Docker's `--cache-to` flag.
936
+ :param pulumi.Input[pulumi.InputType['BuildContextArgs']] context: Build context settings.
937
+
938
+ Equivalent to Docker's `PATH | URL | -` positional argument.
939
+ :param pulumi.Input[pulumi.InputType['DockerfileArgs']] dockerfile: Dockerfile settings.
940
+
941
+ Equivalent to Docker's `--file` flag.
942
+ :param pulumi.Input[bool] exec_: Use `exec` mode to build this image.
943
+
944
+ By default the provider embeds a v25 Docker client with v0.12 buildx
945
+ support. This helps ensure consistent behavior across environments and
946
+ is compatible with alternative build backends (e.g. `buildkitd`), but
947
+ it may not be desirable if you require a specific version of buildx.
948
+ For example you may want to run a custom `docker-buildx` binary with
949
+ support for [Docker Build
950
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
951
+
952
+ When this is set to `true` the provider will instead execute the
953
+ `docker-buildx` binary directly to perform its operations. The user is
954
+ responsible for ensuring this binary exists, with correct permissions
955
+ and pre-configured builders, at a path Docker expects (e.g.
956
+ `~/.docker/cli-plugins`).
957
+
958
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
959
+ to surface fine-grained errors and warnings. Additionally credentials
960
+ are temporarily written to disk in order to provide them to the
961
+ `docker-buildx` binary.
962
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]] exports: Controls where images are persisted after building.
963
+
964
+ Images are only stored in the local cache unless `exports` are
965
+ explicitly configured.
966
+
967
+ Exporting to multiple destinations requires a daemon running BuildKit
968
+ 0.13 or later.
969
+
970
+ Equivalent to Docker's `--output` flag.
971
+ :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image.
972
+
973
+ Equivalent to Docker's `--label` flag.
974
+ :param pulumi.Input[bool] load: When `true` the build will automatically include a `docker` export.
975
+
976
+ Defaults to `false`.
977
+
978
+ Equivalent to Docker's `--load` flag.
979
+ :param pulumi.Input['NetworkMode'] network: Set the network mode for `RUN` instructions. Defaults to `default`.
980
+
981
+ For custom networks, configure your builder with `--driver-opt network=...`.
982
+
983
+ Equivalent to Docker's `--network` flag.
984
+ :param pulumi.Input[bool] no_cache: Do not import cache manifests when building the image.
985
+
986
+ Equivalent to Docker's `--no-cache` flag.
987
+ :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform.
988
+
989
+ Equivalent to Docker's `--platform` flag.
990
+ :param pulumi.Input[bool] pull: Always pull referenced images.
991
+
992
+ Equivalent to Docker's `--pull` flag.
993
+ :param pulumi.Input[bool] push: When `true` the build will automatically include a `registry` export.
994
+
995
+ Defaults to `false`.
996
+
997
+ Equivalent to Docker's `--push` flag.
998
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryArgs']]]] registries: Registry credentials. Required if reading or exporting to private
999
+ repositories.
1000
+
1001
+ Credentials are kept in-memory and do not pollute pre-existing
1002
+ credentials on the host.
1003
+
1004
+ Similar to `docker login`.
1005
+ :param pulumi.Input[Mapping[str, pulumi.Input[str]]] secrets: A mapping of secret names to their corresponding values.
1006
+
1007
+ Unlike the Docker CLI, these can be passed by value and do not need to
1008
+ exist on-disk or in environment variables.
1009
+
1010
+ Build arguments and environment variables are persistent in the final
1011
+ image, so you should use this for sensitive values.
1012
+
1013
+ Similar to Docker's `--secret` flag.
1014
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]] ssh: SSH agent socket or keys to expose to the build.
1015
+
1016
+ Equivalent to Docker's `--ssh` flag.
1017
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] tags: Name and optionally a tag (format: `name:tag`).
1018
+
1019
+ If exporting to a registry, the name should include the fully qualified
1020
+ registry address (e.g. `docker.io/pulumi/pulumi:latest`).
1021
+
1022
+ Equivalent to Docker's `--tag` flag.
1023
+ :param pulumi.Input[str] target: Set the target build stage(s) to build.
1024
+
1025
+ If not specified all targets will be built by default.
1026
+
1027
+ Equivalent to Docker's `--target` flag.
1028
+ """
1029
+ ...
1030
+ @overload
1031
+ def __init__(__self__,
1032
+ resource_name: str,
1033
+ args: Optional[ImageArgs] = None,
1034
+ opts: Optional[pulumi.ResourceOptions] = None):
1035
+ """
1036
+ A Docker image built using buildx -- Docker's interface to the improved
1037
+ BuildKit backend.
1038
+
1039
+ ## Stability
1040
+
1041
+ **This resource is pre-1.0 and in public preview.**
1042
+
1043
+ We will strive to keep APIs and behavior as stable as possible, but we
1044
+ cannot guarantee stability until version 1.0.
1045
+
1046
+ ## Migrating Pulumi Docker v3 and v4 Image resources
1047
+
1048
+ This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
1049
+ Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
1050
+
1051
+ ### Behavioral differences
1052
+
1053
+ There are several key behavioral differences to keep in mind when transitioning images to the new `Image` resource.
1054
+
1055
+ #### Previews
1056
+
1057
+ Version `3.x` of the Pulumi Docker provider always builds images during preview operations.
1058
+ 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.
1059
+
1060
+ Version `4.x` changed build-on-preview behavior to be opt-in.
1061
+ By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
1062
+ Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
1063
+
1064
+ The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
1065
+ This behavior can be changed by specifying `buildOnPreview`.
1066
+
1067
+ #### Push behavior
1068
+
1069
+ Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
1070
+ They expose a `skipPush: true` option to disable pushing.
1071
+
1072
+ This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
1073
+
1074
+ 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`).
1075
+ 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.
1076
+
1077
+ #### Secrets
1078
+
1079
+ Version `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field.
1080
+
1081
+ Version `4.x` of the Pulumi Docker provider does not support secrets.
1082
+
1083
+ The `Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
1084
+ Instead, they should be passed directly as values.
1085
+ (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
1086
+ Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
1087
+
1088
+ #### Caching
1089
+
1090
+ Version `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`.
1091
+ It builds targets individually and pushes them to separate images for caching.
1092
+
1093
+ Version `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches.
1094
+
1095
+ Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
1096
+ This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
1097
+
1098
+ The `Image` resource delegates all caching behavior to Docker.
1099
+ `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.
1100
+
1101
+ #### Outputs
1102
+
1103
+ Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest.
1104
+ In `4.x` this could also be a single sha256 hash if the image wasn't pushed.
1105
+
1106
+ Unlike earlier providers the `Image` resource can push multiple tags.
1107
+ As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed.
1108
+ If multiple tags were pushed this uses one at random.
1109
+
1110
+ If you need more control over tag references you can use the `digest` output, which is always a single sha256 hash as long as the image was exported somewhere.
1111
+
1112
+ #### Tag deletion and refreshes
1113
+
1114
+ 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.
1115
+
1116
+ The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
1117
+ If any are missing a subsequent `update` will push them.
1118
+
1119
+ When a `Image` is deleted, it will _attempt_ to also delete any pushed tags.
1120
+ Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular).
1121
+ Manifests are _not_ deleted in the same way during updates -- to do so safely would require a full build to determine whether a Pulumi operation should be an update or update-replace.
1122
+
1123
+ Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
1124
+
1125
+ ### Example migration
1126
+
1127
+ Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `Image` resource showing how they would look after migration.
1128
+
1129
+ The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
1130
+ After migration, the environment variable is no longer needed and CLI flags are now properties on the `Image`.
1131
+ In almost all cases, properties of `Image` are named after the Docker CLI flag they correspond to.
1132
+
1133
+ The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
1134
+ It it is shown with parameters similar to the `v3` example for completeness.
1135
+
1136
+ ## Example Usage
1137
+
1138
+ ## Example Usage
1139
+ ### Push to AWS ECR with caching
1140
+ ```python
1141
+ import pulumi
1142
+ import pulumi_aws as aws
1143
+ import pulumi_docker_build as docker_build
1144
+
1145
+ ecr_repository = aws.ecr.Repository("ecr-repository")
1146
+ auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
1147
+ my_image = docker_build.Image("my-image",
1148
+ cache_from=[docker_build.CacheFromArgs(
1149
+ registry=docker_build.CacheFromRegistryArgs(
1150
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
1151
+ ),
1152
+ )],
1153
+ cache_to=[docker_build.CacheToArgs(
1154
+ registry=docker_build.CacheToRegistryArgs(
1155
+ image_manifest=True,
1156
+ oci_media_types=True,
1157
+ ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
1158
+ ),
1159
+ )],
1160
+ context=docker_build.BuildContextArgs(
1161
+ location="./app",
1162
+ ),
1163
+ push=True,
1164
+ registries=[docker_build.RegistryArgs(
1165
+ address=ecr_repository.repository_url,
1166
+ password=auth_token.password,
1167
+ username=auth_token.user_name,
1168
+ )],
1169
+ tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
1170
+ pulumi.export("ref", my_image.ref)
1171
+ ```
1172
+ ### Multi-platform image
1173
+ ```python
1174
+ import pulumi
1175
+ import pulumi_docker_build as docker_build
1176
+
1177
+ image = docker_build.Image("image",
1178
+ context=docker_build.BuildContextArgs(
1179
+ location="app",
1180
+ ),
1181
+ platforms=[
1182
+ docker_build.Platform.PLAN9_AMD64,
1183
+ docker_build.Platform.PLAN9_386,
1184
+ ])
1185
+ ```
1186
+ ### Registry export
1187
+ ```python
1188
+ import pulumi
1189
+ import pulumi_docker_build as docker_build
1190
+
1191
+ image = docker_build.Image("image",
1192
+ context=docker_build.BuildContextArgs(
1193
+ location="app",
1194
+ ),
1195
+ push=True,
1196
+ registries=[docker_build.RegistryArgs(
1197
+ address="docker.io",
1198
+ password=docker_hub_password,
1199
+ username="pulumibot",
1200
+ )],
1201
+ tags=["docker.io/pulumi/pulumi:3.107.0"])
1202
+ pulumi.export("ref", my_image["ref"])
1203
+ ```
1204
+ ### Caching
1205
+ ```python
1206
+ import pulumi
1207
+ import pulumi_docker_build as docker_build
1208
+
1209
+ image = docker_build.Image("image",
1210
+ cache_from=[docker_build.CacheFromArgs(
1211
+ local=docker_build.CacheFromLocalArgs(
1212
+ src="tmp/cache",
1213
+ ),
1214
+ )],
1215
+ cache_to=[docker_build.CacheToArgs(
1216
+ local=docker_build.CacheToLocalArgs(
1217
+ dest="tmp/cache",
1218
+ mode=docker_build.CacheMode.MAX,
1219
+ ),
1220
+ )],
1221
+ context=docker_build.BuildContextArgs(
1222
+ location="app",
1223
+ ))
1224
+ ```
1225
+ ### Docker Build Cloud
1226
+ ```python
1227
+ import pulumi
1228
+ import pulumi_docker_build as docker_build
1229
+
1230
+ image = docker_build.Image("image",
1231
+ builder=docker_build.BuilderConfigArgs(
1232
+ name="cloud-builder-name",
1233
+ ),
1234
+ context=docker_build.BuildContextArgs(
1235
+ location="app",
1236
+ ),
1237
+ exec_=True)
1238
+ ```
1239
+ ### Build arguments
1240
+ ```python
1241
+ import pulumi
1242
+ import pulumi_docker_build as docker_build
1243
+
1244
+ image = docker_build.Image("image",
1245
+ build_args={
1246
+ "SET_ME_TO_TRUE": "true",
1247
+ },
1248
+ context=docker_build.BuildContextArgs(
1249
+ location="app",
1250
+ ))
1251
+ ```
1252
+ ### Build target
1253
+ ```python
1254
+ import pulumi
1255
+ import pulumi_docker_build as docker_build
1256
+
1257
+ image = docker_build.Image("image",
1258
+ context=docker_build.BuildContextArgs(
1259
+ location="app",
1260
+ ),
1261
+ target="build-me")
1262
+ ```
1263
+ ### Named contexts
1264
+ ```python
1265
+ import pulumi
1266
+ import pulumi_docker_build as docker_build
1267
+
1268
+ image = docker_build.Image("image", context=docker_build.BuildContextArgs(
1269
+ location="app",
1270
+ named={
1271
+ "golang:latest": docker_build.ContextArgs(
1272
+ location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
1273
+ ),
1274
+ },
1275
+ ))
1276
+ ```
1277
+ ### Remote context
1278
+ ```python
1279
+ import pulumi
1280
+ import pulumi_docker_build as docker_build
1281
+
1282
+ image = docker_build.Image("image", context=docker_build.BuildContextArgs(
1283
+ location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
1284
+ ))
1285
+ ```
1286
+ ### Inline Dockerfile
1287
+ ```python
1288
+ import pulumi
1289
+ import pulumi_docker_build as docker_build
1290
+
1291
+ image = docker_build.Image("image",
1292
+ context=docker_build.BuildContextArgs(
1293
+ location="app",
1294
+ ),
1295
+ dockerfile=docker_build.DockerfileArgs(
1296
+ inline=\"\"\"FROM busybox
1297
+ COPY hello.c ./
1298
+ \"\"\",
1299
+ ))
1300
+ ```
1301
+ ### Remote context
1302
+ ```python
1303
+ import pulumi
1304
+ import pulumi_docker_build as docker_build
1305
+
1306
+ image = docker_build.Image("image",
1307
+ context=docker_build.BuildContextArgs(
1308
+ location="https://github.com/docker-library/hello-world.git",
1309
+ ),
1310
+ dockerfile=docker_build.DockerfileArgs(
1311
+ location="app/Dockerfile",
1312
+ ))
1313
+ ```
1314
+ ### Local export
1315
+ ```python
1316
+ import pulumi
1317
+ import pulumi_docker_build as docker_build
1318
+
1319
+ image = docker_build.Image("image",
1320
+ context=docker_build.BuildContextArgs(
1321
+ location="app",
1322
+ ),
1323
+ exports=[docker_build.ExportArgs(
1324
+ docker=docker_build.ExportDockerArgs(
1325
+ tar=True,
1326
+ ),
1327
+ )])
1328
+ ```
1329
+
1330
+ :param str resource_name: The name of the resource.
1331
+ :param ImageArgs args: The arguments to use to populate this resource's properties.
1332
+ :param pulumi.ResourceOptions opts: Options for the resource.
1333
+ """
1334
+ ...
1335
+ def __init__(__self__, resource_name: str, *args, **kwargs):
1336
+ resource_args, opts = _utilities.get_resource_args_opts(ImageArgs, pulumi.ResourceOptions, *args, **kwargs)
1337
+ if resource_args is not None:
1338
+ __self__._internal_init(resource_name, opts, **resource_args.__dict__)
1339
+ else:
1340
+ __self__._internal_init(resource_name, *args, **kwargs)
1341
+
1342
+ def _internal_init(__self__,
1343
+ resource_name: str,
1344
+ opts: Optional[pulumi.ResourceOptions] = None,
1345
+ add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
1346
+ build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1347
+ build_on_preview: Optional[pulumi.Input[bool]] = None,
1348
+ builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None,
1349
+ cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]]] = None,
1350
+ cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]]] = None,
1351
+ context: Optional[pulumi.Input[pulumi.InputType['BuildContextArgs']]] = None,
1352
+ dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None,
1353
+ exec_: Optional[pulumi.Input[bool]] = None,
1354
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]]] = None,
1355
+ labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1356
+ load: Optional[pulumi.Input[bool]] = None,
1357
+ network: Optional[pulumi.Input['NetworkMode']] = None,
1358
+ no_cache: Optional[pulumi.Input[bool]] = None,
1359
+ platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None,
1360
+ pull: Optional[pulumi.Input[bool]] = None,
1361
+ push: Optional[pulumi.Input[bool]] = None,
1362
+ registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryArgs']]]]] = None,
1363
+ secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1364
+ ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None,
1365
+ tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
1366
+ target: Optional[pulumi.Input[str]] = None,
1367
+ __props__=None):
1368
+ opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
1369
+ if not isinstance(opts, pulumi.ResourceOptions):
1370
+ raise TypeError('Expected resource options to be a ResourceOptions instance')
1371
+ if opts.id is None:
1372
+ if __props__ is not None:
1373
+ raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
1374
+ __props__ = ImageArgs.__new__(ImageArgs)
1375
+
1376
+ __props__.__dict__["add_hosts"] = add_hosts
1377
+ __props__.__dict__["build_args"] = build_args
1378
+ if build_on_preview is None:
1379
+ build_on_preview = True
1380
+ __props__.__dict__["build_on_preview"] = build_on_preview
1381
+ __props__.__dict__["builder"] = builder
1382
+ __props__.__dict__["cache_from"] = cache_from
1383
+ __props__.__dict__["cache_to"] = cache_to
1384
+ __props__.__dict__["context"] = context
1385
+ __props__.__dict__["dockerfile"] = dockerfile
1386
+ __props__.__dict__["exec_"] = exec_
1387
+ __props__.__dict__["exports"] = exports
1388
+ __props__.__dict__["labels"] = labels
1389
+ __props__.__dict__["load"] = load
1390
+ if network is None:
1391
+ network = 'default'
1392
+ __props__.__dict__["network"] = network
1393
+ __props__.__dict__["no_cache"] = no_cache
1394
+ __props__.__dict__["platforms"] = platforms
1395
+ __props__.__dict__["pull"] = pull
1396
+ __props__.__dict__["push"] = push
1397
+ __props__.__dict__["registries"] = registries
1398
+ __props__.__dict__["secrets"] = secrets
1399
+ __props__.__dict__["ssh"] = ssh
1400
+ __props__.__dict__["tags"] = tags
1401
+ __props__.__dict__["target"] = target
1402
+ __props__.__dict__["context_hash"] = None
1403
+ __props__.__dict__["digest"] = None
1404
+ __props__.__dict__["ref"] = None
1405
+ super(Image, __self__).__init__(
1406
+ 'docker-build:index:Image',
1407
+ resource_name,
1408
+ __props__,
1409
+ opts)
1410
+
1411
+ @staticmethod
1412
+ def get(resource_name: str,
1413
+ id: pulumi.Input[str],
1414
+ opts: Optional[pulumi.ResourceOptions] = None) -> 'Image':
1415
+ """
1416
+ Get an existing Image resource's state with the given name, id, and optional extra
1417
+ properties used to qualify the lookup.
1418
+
1419
+ :param str resource_name: The unique name of the resulting resource.
1420
+ :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
1421
+ :param pulumi.ResourceOptions opts: Options for the resource.
1422
+ """
1423
+ opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
1424
+
1425
+ __props__ = ImageArgs.__new__(ImageArgs)
1426
+
1427
+ __props__.__dict__["add_hosts"] = None
1428
+ __props__.__dict__["build_args"] = None
1429
+ __props__.__dict__["build_on_preview"] = None
1430
+ __props__.__dict__["builder"] = None
1431
+ __props__.__dict__["cache_from"] = None
1432
+ __props__.__dict__["cache_to"] = None
1433
+ __props__.__dict__["context"] = None
1434
+ __props__.__dict__["context_hash"] = None
1435
+ __props__.__dict__["digest"] = None
1436
+ __props__.__dict__["dockerfile"] = None
1437
+ __props__.__dict__["exec_"] = None
1438
+ __props__.__dict__["exports"] = None
1439
+ __props__.__dict__["labels"] = None
1440
+ __props__.__dict__["load"] = None
1441
+ __props__.__dict__["network"] = None
1442
+ __props__.__dict__["no_cache"] = None
1443
+ __props__.__dict__["platforms"] = None
1444
+ __props__.__dict__["pull"] = None
1445
+ __props__.__dict__["push"] = None
1446
+ __props__.__dict__["ref"] = None
1447
+ __props__.__dict__["registries"] = None
1448
+ __props__.__dict__["secrets"] = None
1449
+ __props__.__dict__["ssh"] = None
1450
+ __props__.__dict__["tags"] = None
1451
+ __props__.__dict__["target"] = None
1452
+ return Image(resource_name, opts=opts, __props__=__props__)
1453
+
1454
+ @property
1455
+ @pulumi.getter(name="addHosts")
1456
+ def add_hosts(self) -> pulumi.Output[Optional[Sequence[str]]]:
1457
+ """
1458
+ Custom `host:ip` mappings to use during the build.
1459
+
1460
+ Equivalent to Docker's `--add-host` flag.
1461
+ """
1462
+ return pulumi.get(self, "add_hosts")
1463
+
1464
+ @property
1465
+ @pulumi.getter(name="buildArgs")
1466
+ def build_args(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
1467
+ """
1468
+ `ARG` names and values to set during the build.
1469
+
1470
+ These variables are accessed like environment variables inside `RUN`
1471
+ instructions.
1472
+
1473
+ Build arguments are persisted in the image, so you should use `secrets`
1474
+ if these arguments are sensitive.
1475
+
1476
+ Equivalent to Docker's `--build-arg` flag.
1477
+ """
1478
+ return pulumi.get(self, "build_args")
1479
+
1480
+ @property
1481
+ @pulumi.getter(name="buildOnPreview")
1482
+ def build_on_preview(self) -> pulumi.Output[Optional[bool]]:
1483
+ """
1484
+ Setting this to `false` will always skip image builds during previews,
1485
+ and setting it to `true` will always build images during previews.
1486
+
1487
+ Images built during previews are never exported to registries, however
1488
+ cache manifests are still exported.
1489
+
1490
+ On-disk Dockerfiles are always validated for syntactic correctness
1491
+ regardless of this setting.
1492
+
1493
+ Defaults to `true` as a safeguard against broken images merging as part
1494
+ of CI pipelines.
1495
+ """
1496
+ return pulumi.get(self, "build_on_preview")
1497
+
1498
+ @property
1499
+ @pulumi.getter
1500
+ def builder(self) -> pulumi.Output[Optional['outputs.BuilderConfig']]:
1501
+ """
1502
+ Builder configuration.
1503
+ """
1504
+ return pulumi.get(self, "builder")
1505
+
1506
+ @property
1507
+ @pulumi.getter(name="cacheFrom")
1508
+ def cache_from(self) -> pulumi.Output[Optional[Sequence['outputs.CacheFrom']]]:
1509
+ """
1510
+ Cache export configuration.
1511
+
1512
+ Equivalent to Docker's `--cache-from` flag.
1513
+ """
1514
+ return pulumi.get(self, "cache_from")
1515
+
1516
+ @property
1517
+ @pulumi.getter(name="cacheTo")
1518
+ def cache_to(self) -> pulumi.Output[Optional[Sequence['outputs.CacheTo']]]:
1519
+ """
1520
+ Cache import configuration.
1521
+
1522
+ Equivalent to Docker's `--cache-to` flag.
1523
+ """
1524
+ return pulumi.get(self, "cache_to")
1525
+
1526
+ @property
1527
+ @pulumi.getter
1528
+ def context(self) -> pulumi.Output[Optional['outputs.BuildContext']]:
1529
+ """
1530
+ Build context settings.
1531
+
1532
+ Equivalent to Docker's `PATH | URL | -` positional argument.
1533
+ """
1534
+ return pulumi.get(self, "context")
1535
+
1536
+ @property
1537
+ @pulumi.getter(name="contextHash")
1538
+ def context_hash(self) -> pulumi.Output[str]:
1539
+ """
1540
+ A preliminary hash of the image's build context.
1541
+
1542
+ Pulumi uses this to determine if an image _may_ need to be re-built.
1543
+ """
1544
+ return pulumi.get(self, "context_hash")
1545
+
1546
+ @property
1547
+ @pulumi.getter
1548
+ def digest(self) -> pulumi.Output[str]:
1549
+ """
1550
+ A SHA256 digest of the image if it was exported to a registry or
1551
+ elsewhere.
1552
+
1553
+ Empty if the image was not exported.
1554
+
1555
+ Registry images can be referenced precisely as `<tag>@<digest>`. The
1556
+ `ref` output provides one such reference as a convenience.
1557
+ """
1558
+ return pulumi.get(self, "digest")
1559
+
1560
+ @property
1561
+ @pulumi.getter
1562
+ def dockerfile(self) -> pulumi.Output[Optional['outputs.Dockerfile']]:
1563
+ """
1564
+ Dockerfile settings.
1565
+
1566
+ Equivalent to Docker's `--file` flag.
1567
+ """
1568
+ return pulumi.get(self, "dockerfile")
1569
+
1570
+ @property
1571
+ @pulumi.getter(name="exec")
1572
+ def exec_(self) -> pulumi.Output[Optional[bool]]:
1573
+ """
1574
+ Use `exec` mode to build this image.
1575
+
1576
+ By default the provider embeds a v25 Docker client with v0.12 buildx
1577
+ support. This helps ensure consistent behavior across environments and
1578
+ is compatible with alternative build backends (e.g. `buildkitd`), but
1579
+ it may not be desirable if you require a specific version of buildx.
1580
+ For example you may want to run a custom `docker-buildx` binary with
1581
+ support for [Docker Build
1582
+ Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
1583
+
1584
+ When this is set to `true` the provider will instead execute the
1585
+ `docker-buildx` binary directly to perform its operations. The user is
1586
+ responsible for ensuring this binary exists, with correct permissions
1587
+ and pre-configured builders, at a path Docker expects (e.g.
1588
+ `~/.docker/cli-plugins`).
1589
+
1590
+ Debugging `exec` mode may be more difficult as Pulumi will not be able
1591
+ to surface fine-grained errors and warnings. Additionally credentials
1592
+ are temporarily written to disk in order to provide them to the
1593
+ `docker-buildx` binary.
1594
+ """
1595
+ return pulumi.get(self, "exec_")
1596
+
1597
+ @property
1598
+ @pulumi.getter
1599
+ def exports(self) -> pulumi.Output[Optional[Sequence['outputs.Export']]]:
1600
+ """
1601
+ Controls where images are persisted after building.
1602
+
1603
+ Images are only stored in the local cache unless `exports` are
1604
+ explicitly configured.
1605
+
1606
+ Exporting to multiple destinations requires a daemon running BuildKit
1607
+ 0.13 or later.
1608
+
1609
+ Equivalent to Docker's `--output` flag.
1610
+ """
1611
+ return pulumi.get(self, "exports")
1612
+
1613
+ @property
1614
+ @pulumi.getter
1615
+ def labels(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
1616
+ """
1617
+ Attach arbitrary key/value metadata to the image.
1618
+
1619
+ Equivalent to Docker's `--label` flag.
1620
+ """
1621
+ return pulumi.get(self, "labels")
1622
+
1623
+ @property
1624
+ @pulumi.getter
1625
+ def load(self) -> pulumi.Output[Optional[bool]]:
1626
+ """
1627
+ When `true` the build will automatically include a `docker` export.
1628
+
1629
+ Defaults to `false`.
1630
+
1631
+ Equivalent to Docker's `--load` flag.
1632
+ """
1633
+ return pulumi.get(self, "load")
1634
+
1635
+ @property
1636
+ @pulumi.getter
1637
+ def network(self) -> pulumi.Output[Optional['NetworkMode']]:
1638
+ """
1639
+ Set the network mode for `RUN` instructions. Defaults to `default`.
1640
+
1641
+ For custom networks, configure your builder with `--driver-opt network=...`.
1642
+
1643
+ Equivalent to Docker's `--network` flag.
1644
+ """
1645
+ return pulumi.get(self, "network")
1646
+
1647
+ @property
1648
+ @pulumi.getter(name="noCache")
1649
+ def no_cache(self) -> pulumi.Output[Optional[bool]]:
1650
+ """
1651
+ Do not import cache manifests when building the image.
1652
+
1653
+ Equivalent to Docker's `--no-cache` flag.
1654
+ """
1655
+ return pulumi.get(self, "no_cache")
1656
+
1657
+ @property
1658
+ @pulumi.getter
1659
+ def platforms(self) -> pulumi.Output[Optional[Sequence['Platform']]]:
1660
+ """
1661
+ Set target platform(s) for the build. Defaults to the host's platform.
1662
+
1663
+ Equivalent to Docker's `--platform` flag.
1664
+ """
1665
+ return pulumi.get(self, "platforms")
1666
+
1667
+ @property
1668
+ @pulumi.getter
1669
+ def pull(self) -> pulumi.Output[Optional[bool]]:
1670
+ """
1671
+ Always pull referenced images.
1672
+
1673
+ Equivalent to Docker's `--pull` flag.
1674
+ """
1675
+ return pulumi.get(self, "pull")
1676
+
1677
+ @property
1678
+ @pulumi.getter
1679
+ def push(self) -> pulumi.Output[Optional[bool]]:
1680
+ """
1681
+ When `true` the build will automatically include a `registry` export.
1682
+
1683
+ Defaults to `false`.
1684
+
1685
+ Equivalent to Docker's `--push` flag.
1686
+ """
1687
+ return pulumi.get(self, "push")
1688
+
1689
+ @property
1690
+ @pulumi.getter
1691
+ def ref(self) -> pulumi.Output[str]:
1692
+ """
1693
+ If the image was pushed to any registries then this will contain a
1694
+ single fully-qualified tag including the build's digest.
1695
+
1696
+ If the image had tags but was not exported, this will take on a value
1697
+ of one of those tags.
1698
+
1699
+ This will be empty if the image had no exports and no tags.
1700
+
1701
+ This is only for convenience and may not be appropriate for situations
1702
+ where multiple tags or registries are involved. In those cases this
1703
+ output is not guaranteed to be stable.
1704
+
1705
+ For more control over tags consumed by downstream resources you should
1706
+ use the `digest` output.
1707
+ """
1708
+ return pulumi.get(self, "ref")
1709
+
1710
+ @property
1711
+ @pulumi.getter
1712
+ def registries(self) -> pulumi.Output[Optional[Sequence['outputs.Registry']]]:
1713
+ """
1714
+ Registry credentials. Required if reading or exporting to private
1715
+ repositories.
1716
+
1717
+ Credentials are kept in-memory and do not pollute pre-existing
1718
+ credentials on the host.
1719
+
1720
+ Similar to `docker login`.
1721
+ """
1722
+ return pulumi.get(self, "registries")
1723
+
1724
+ @property
1725
+ @pulumi.getter
1726
+ def secrets(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
1727
+ """
1728
+ A mapping of secret names to their corresponding values.
1729
+
1730
+ Unlike the Docker CLI, these can be passed by value and do not need to
1731
+ exist on-disk or in environment variables.
1732
+
1733
+ Build arguments and environment variables are persistent in the final
1734
+ image, so you should use this for sensitive values.
1735
+
1736
+ Similar to Docker's `--secret` flag.
1737
+ """
1738
+ return pulumi.get(self, "secrets")
1739
+
1740
+ @property
1741
+ @pulumi.getter
1742
+ def ssh(self) -> pulumi.Output[Optional[Sequence['outputs.SSH']]]:
1743
+ """
1744
+ SSH agent socket or keys to expose to the build.
1745
+
1746
+ Equivalent to Docker's `--ssh` flag.
1747
+ """
1748
+ return pulumi.get(self, "ssh")
1749
+
1750
+ @property
1751
+ @pulumi.getter
1752
+ def tags(self) -> pulumi.Output[Optional[Sequence[str]]]:
1753
+ """
1754
+ Name and optionally a tag (format: `name:tag`).
1755
+
1756
+ If exporting to a registry, the name should include the fully qualified
1757
+ registry address (e.g. `docker.io/pulumi/pulumi:latest`).
1758
+
1759
+ Equivalent to Docker's `--tag` flag.
1760
+ """
1761
+ return pulumi.get(self, "tags")
1762
+
1763
+ @property
1764
+ @pulumi.getter
1765
+ def target(self) -> pulumi.Output[Optional[str]]:
1766
+ """
1767
+ Set the target build stage(s) to build.
1768
+
1769
+ If not specified all targets will be built by default.
1770
+
1771
+ Equivalent to Docker's `--target` flag.
1772
+ """
1773
+ return pulumi.get(self, "target")
1774
+