pulumi-docker 4.6.0b3__py3-none-any.whl → 4.6.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 might be problematic. Click here for more details.

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