pulumi-docker 4.6.0b2__py3-none-any.whl → 4.6.0b4__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.

@@ -21,11 +21,12 @@ class ImageArgs:
21
21
  build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
22
22
  build_on_preview: Optional[pulumi.Input[bool]] = None,
23
23
  builder: Optional[pulumi.Input['BuilderConfigArgs']] = None,
24
- cache_from: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]]] = None,
25
- cache_to: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]]] = None,
24
+ cache_from: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]] = None,
25
+ cache_to: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]] = None,
26
26
  context: Optional[pulumi.Input['BuildContextArgs']] = None,
27
27
  dockerfile: Optional[pulumi.Input['DockerfileArgs']] = None,
28
- exports: Optional[pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]]] = None,
28
+ exec_: Optional[pulumi.Input[bool]] = None,
29
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]] = None,
29
30
  labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
30
31
  load: Optional[pulumi.Input[bool]] = None,
31
32
  network: Optional[pulumi.Input['NetworkMode']] = None,
@@ -37,7 +38,7 @@ class ImageArgs:
37
38
  secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
38
39
  ssh: Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]] = None,
39
40
  tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
40
- targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
41
+ target: Optional[pulumi.Input[str]] = None):
41
42
  """
42
43
  The set of arguments for constructing a Image resource.
43
44
  :param pulumi.Input[Sequence[pulumi.Input[str]]] add_hosts: Custom `host:ip` mappings to use during the build.
@@ -67,10 +68,10 @@ class ImageArgs:
67
68
  On-disk Dockerfiles are always validated for syntactic correctness
68
69
  regardless of this setting.
69
70
  :param pulumi.Input['BuilderConfigArgs'] builder: Builder configuration.
70
- :param pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]] cache_from: Cache export configuration.
71
+ :param pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]] cache_from: Cache export configuration.
71
72
 
72
73
  Equivalent to Docker's `--cache-from` flag.
73
- :param pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]] cache_to: Cache import configuration.
74
+ :param pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]] cache_to: Cache import configuration.
74
75
 
75
76
  Equivalent to Docker's `--cache-to` flag.
76
77
  :param pulumi.Input['BuildContextArgs'] context: Build context settings.
@@ -79,11 +80,34 @@ class ImageArgs:
79
80
  :param pulumi.Input['DockerfileArgs'] dockerfile: Dockerfile settings.
80
81
 
81
82
  Equivalent to Docker's `--file` flag.
82
- :param pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]] exports: Controls where images are persisted after building.
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.
83
104
 
84
105
  Images are only stored in the local cache unless `exports` are
85
106
  explicitly configured.
86
107
 
108
+ Exporting to multiple destinations requires a daemon running BuildKit
109
+ 0.13 or later.
110
+
87
111
  Equivalent to Docker's `--output` flag.
88
112
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image.
89
113
 
@@ -137,7 +161,7 @@ class ImageArgs:
137
161
  registry address (e.g. `docker.io/pulumi/pulumi:latest`).
138
162
 
139
163
  Equivalent to Docker's `--tag` flag.
140
- :param pulumi.Input[Sequence[pulumi.Input[str]]] targets: Set the target build stage(s) to build.
164
+ :param pulumi.Input[str] target: Set the target build stage(s) to build.
141
165
 
142
166
  If not specified all targets will be built by default.
143
167
 
@@ -159,6 +183,8 @@ class ImageArgs:
159
183
  pulumi.set(__self__, "context", context)
160
184
  if dockerfile is not None:
161
185
  pulumi.set(__self__, "dockerfile", dockerfile)
186
+ if exec_ is not None:
187
+ pulumi.set(__self__, "exec_", exec_)
162
188
  if exports is not None:
163
189
  pulumi.set(__self__, "exports", exports)
164
190
  if labels is not None:
@@ -185,8 +211,8 @@ class ImageArgs:
185
211
  pulumi.set(__self__, "ssh", ssh)
186
212
  if tags is not None:
187
213
  pulumi.set(__self__, "tags", tags)
188
- if targets is not None:
189
- pulumi.set(__self__, "targets", targets)
214
+ if target is not None:
215
+ pulumi.set(__self__, "target", target)
190
216
 
191
217
  @property
192
218
  @pulumi.getter(name="addHosts")
@@ -261,7 +287,7 @@ class ImageArgs:
261
287
 
262
288
  @property
263
289
  @pulumi.getter(name="cacheFrom")
264
- def cache_from(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]]]:
290
+ def cache_from(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]]:
265
291
  """
266
292
  Cache export configuration.
267
293
 
@@ -270,12 +296,12 @@ class ImageArgs:
270
296
  return pulumi.get(self, "cache_from")
271
297
 
272
298
  @cache_from.setter
273
- def cache_from(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]]]):
299
+ def cache_from(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]]]):
274
300
  pulumi.set(self, "cache_from", value)
275
301
 
276
302
  @property
277
303
  @pulumi.getter(name="cacheTo")
278
- def cache_to(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]]]:
304
+ def cache_to(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]]:
279
305
  """
280
306
  Cache import configuration.
281
307
 
@@ -284,7 +310,7 @@ class ImageArgs:
284
310
  return pulumi.get(self, "cache_to")
285
311
 
286
312
  @cache_to.setter
287
- def cache_to(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToEntryArgs']]]]):
313
+ def cache_to(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]]]):
288
314
  pulumi.set(self, "cache_to", value)
289
315
 
290
316
  @property
@@ -315,21 +341,55 @@ class ImageArgs:
315
341
  def dockerfile(self, value: Optional[pulumi.Input['DockerfileArgs']]):
316
342
  pulumi.set(self, "dockerfile", value)
317
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
+
318
375
  @property
319
376
  @pulumi.getter
320
- def exports(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]]]:
377
+ def exports(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]]:
321
378
  """
322
379
  Controls where images are persisted after building.
323
380
 
324
381
  Images are only stored in the local cache unless `exports` are
325
382
  explicitly configured.
326
383
 
384
+ Exporting to multiple destinations requires a daemon running BuildKit
385
+ 0.13 or later.
386
+
327
387
  Equivalent to Docker's `--output` flag.
328
388
  """
329
389
  return pulumi.get(self, "exports")
330
390
 
331
391
  @exports.setter
332
- def exports(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]]]):
392
+ def exports(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ExportArgs']]]]):
333
393
  pulumi.set(self, "exports", value)
334
394
 
335
395
  @property
@@ -507,7 +567,7 @@ class ImageArgs:
507
567
 
508
568
  @property
509
569
  @pulumi.getter
510
- def targets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
570
+ def target(self) -> Optional[pulumi.Input[str]]:
511
571
  """
512
572
  Set the target build stage(s) to build.
513
573
 
@@ -515,11 +575,11 @@ class ImageArgs:
515
575
 
516
576
  Equivalent to Docker's `--target` flag.
517
577
  """
518
- return pulumi.get(self, "targets")
578
+ return pulumi.get(self, "target")
519
579
 
520
- @targets.setter
521
- def targets(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
522
- pulumi.set(self, "targets", value)
580
+ @target.setter
581
+ def target(self, value: Optional[pulumi.Input[str]]):
582
+ pulumi.set(self, "target", value)
523
583
 
524
584
 
525
585
  class Image(pulumi.CustomResource):
@@ -531,11 +591,12 @@ class Image(pulumi.CustomResource):
531
591
  build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
532
592
  build_on_preview: Optional[pulumi.Input[bool]] = None,
533
593
  builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None,
534
- cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromEntryArgs']]]]] = None,
535
- cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToEntryArgs']]]]] = 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,
536
596
  context: Optional[pulumi.Input[pulumi.InputType['BuildContextArgs']]] = None,
537
597
  dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None,
538
- exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]]] = None,
598
+ exec_: Optional[pulumi.Input[bool]] = None,
599
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]]] = None,
539
600
  labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
540
601
  load: Optional[pulumi.Input[bool]] = None,
541
602
  network: Optional[pulumi.Input['NetworkMode']] = None,
@@ -547,7 +608,7 @@ class Image(pulumi.CustomResource):
547
608
  secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
548
609
  ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None,
549
610
  tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
550
- targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
611
+ target: Optional[pulumi.Input[str]] = None,
551
612
  __props__=None):
552
613
  """
553
614
  A Docker image built using buildx -- Docker's interface to the improved
@@ -625,7 +686,14 @@ class Image(pulumi.CustomResource):
625
686
 
626
687
  #### Outputs
627
688
 
628
- TODO:
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.
629
697
 
630
698
  #### Tag deletion and refreshes
631
699
 
@@ -635,7 +703,8 @@ class Image(pulumi.CustomResource):
635
703
  If any are missing a subsequent `update` will push them.
636
704
 
637
705
  When a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.
638
- Deletion of remote tags is not guaranteed, because not all registries currently support this operation (`docker.io` in particular).
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.
639
708
 
640
709
  Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
641
710
 
@@ -662,12 +731,12 @@ class Image(pulumi.CustomResource):
662
731
  ecr_repository = aws.ecr.Repository("ecr-repository")
663
732
  auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
664
733
  my_image = docker.buildx.Image("my-image",
665
- cache_from=[docker.buildx.CacheFromEntryArgs(
734
+ cache_from=[docker.buildx.CacheFromArgs(
666
735
  registry=docker.buildx.CacheFromRegistryArgs(
667
736
  ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
668
737
  ),
669
738
  )],
670
- cache_to=[docker.buildx.CacheToEntryArgs(
739
+ cache_to=[docker.buildx.CacheToArgs(
671
740
  registry=docker.buildx.CacheToRegistryArgs(
672
741
  image_manifest=True,
673
742
  oci_media_types=True,
@@ -677,9 +746,6 @@ class Image(pulumi.CustomResource):
677
746
  context=docker.buildx.BuildContextArgs(
678
747
  location="./app",
679
748
  ),
680
- dockerfile=docker.buildx.DockerfileArgs(
681
- location="./Dockerfile",
682
- ),
683
749
  push=True,
684
750
  registries=[docker.buildx.RegistryAuthArgs(
685
751
  address=ecr_repository.repository_url,
@@ -687,6 +753,7 @@ class Image(pulumi.CustomResource):
687
753
  username=auth_token.user_name,
688
754
  )],
689
755
  tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
756
+ pulumi.export("ref", my_image.ref)
690
757
  ```
691
758
  ### Multi-platform image
692
759
  ```python
@@ -718,6 +785,7 @@ class Image(pulumi.CustomResource):
718
785
  username="pulumibot",
719
786
  )],
720
787
  tags=["docker.io/pulumi/pulumi:3.107.0"])
788
+ pulumi.export("ref", my_image["ref"])
721
789
  ```
722
790
  ### Caching
723
791
  ```python
@@ -725,12 +793,12 @@ class Image(pulumi.CustomResource):
725
793
  import pulumi_docker as docker
726
794
 
727
795
  image = docker.buildx.Image("image",
728
- cache_from=[docker.buildx.CacheFromEntryArgs(
796
+ cache_from=[docker.buildx.CacheFromArgs(
729
797
  local=docker.buildx.CacheFromLocalArgs(
730
798
  src="tmp/cache",
731
799
  ),
732
800
  )],
733
- cache_to=[docker.buildx.CacheToEntryArgs(
801
+ cache_to=[docker.buildx.CacheToArgs(
734
802
  local=docker.buildx.CacheToLocalArgs(
735
803
  dest="tmp/cache",
736
804
  mode=docker.buildx/image.CacheMode.MAX,
@@ -740,6 +808,20 @@ class Image(pulumi.CustomResource):
740
808
  location="app",
741
809
  ))
742
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
+ ```
743
825
  ### Build arguments
744
826
  ```python
745
827
  import pulumi
@@ -753,7 +835,7 @@ class Image(pulumi.CustomResource):
753
835
  location="app",
754
836
  ))
755
837
  ```
756
- ### Build targets
838
+ ### Build target
757
839
  ```python
758
840
  import pulumi
759
841
  import pulumi_docker as docker
@@ -762,10 +844,7 @@ class Image(pulumi.CustomResource):
762
844
  context=docker.buildx.BuildContextArgs(
763
845
  location="app",
764
846
  ),
765
- targets=[
766
- "build-me",
767
- "also-build-me",
768
- ])
847
+ target="build-me")
769
848
  ```
770
849
  ### Named contexts
771
850
  ```python
@@ -827,7 +906,7 @@ class Image(pulumi.CustomResource):
827
906
  context=docker.buildx.BuildContextArgs(
828
907
  location="app",
829
908
  ),
830
- exports=[docker.buildx.ExportEntryArgs(
909
+ exports=[docker.buildx.ExportArgs(
831
910
  docker=docker.buildx.ExportDockerArgs(
832
911
  tar=True,
833
912
  ),
@@ -863,10 +942,10 @@ class Image(pulumi.CustomResource):
863
942
  On-disk Dockerfiles are always validated for syntactic correctness
864
943
  regardless of this setting.
865
944
  :param pulumi.Input[pulumi.InputType['BuilderConfigArgs']] builder: Builder configuration.
866
- :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromEntryArgs']]]] cache_from: Cache export configuration.
945
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]] cache_from: Cache export configuration.
867
946
 
868
947
  Equivalent to Docker's `--cache-from` flag.
869
- :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToEntryArgs']]]] cache_to: Cache import configuration.
948
+ :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]] cache_to: Cache import configuration.
870
949
 
871
950
  Equivalent to Docker's `--cache-to` flag.
872
951
  :param pulumi.Input[pulumi.InputType['BuildContextArgs']] context: Build context settings.
@@ -875,11 +954,34 @@ class Image(pulumi.CustomResource):
875
954
  :param pulumi.Input[pulumi.InputType['DockerfileArgs']] dockerfile: Dockerfile settings.
876
955
 
877
956
  Equivalent to Docker's `--file` flag.
878
- :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]] exports: Controls where images are persisted after building.
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.
879
978
 
880
979
  Images are only stored in the local cache unless `exports` are
881
980
  explicitly configured.
882
981
 
982
+ Exporting to multiple destinations requires a daemon running BuildKit
983
+ 0.13 or later.
984
+
883
985
  Equivalent to Docker's `--output` flag.
884
986
  :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image.
885
987
 
@@ -933,7 +1035,7 @@ class Image(pulumi.CustomResource):
933
1035
  registry address (e.g. `docker.io/pulumi/pulumi:latest`).
934
1036
 
935
1037
  Equivalent to Docker's `--tag` flag.
936
- :param pulumi.Input[Sequence[pulumi.Input[str]]] targets: Set the target build stage(s) to build.
1038
+ :param pulumi.Input[str] target: Set the target build stage(s) to build.
937
1039
 
938
1040
  If not specified all targets will be built by default.
939
1041
 
@@ -1021,7 +1123,14 @@ class Image(pulumi.CustomResource):
1021
1123
 
1022
1124
  #### Outputs
1023
1125
 
1024
- TODO:
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.
1025
1134
 
1026
1135
  #### Tag deletion and refreshes
1027
1136
 
@@ -1031,7 +1140,8 @@ class Image(pulumi.CustomResource):
1031
1140
  If any are missing a subsequent `update` will push them.
1032
1141
 
1033
1142
  When a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.
1034
- Deletion of remote tags is not guaranteed, because not all registries currently support this operation (`docker.io` in particular).
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.
1035
1145
 
1036
1146
  Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
1037
1147
 
@@ -1058,12 +1168,12 @@ class Image(pulumi.CustomResource):
1058
1168
  ecr_repository = aws.ecr.Repository("ecr-repository")
1059
1169
  auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
1060
1170
  my_image = docker.buildx.Image("my-image",
1061
- cache_from=[docker.buildx.CacheFromEntryArgs(
1171
+ cache_from=[docker.buildx.CacheFromArgs(
1062
1172
  registry=docker.buildx.CacheFromRegistryArgs(
1063
1173
  ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
1064
1174
  ),
1065
1175
  )],
1066
- cache_to=[docker.buildx.CacheToEntryArgs(
1176
+ cache_to=[docker.buildx.CacheToArgs(
1067
1177
  registry=docker.buildx.CacheToRegistryArgs(
1068
1178
  image_manifest=True,
1069
1179
  oci_media_types=True,
@@ -1073,9 +1183,6 @@ class Image(pulumi.CustomResource):
1073
1183
  context=docker.buildx.BuildContextArgs(
1074
1184
  location="./app",
1075
1185
  ),
1076
- dockerfile=docker.buildx.DockerfileArgs(
1077
- location="./Dockerfile",
1078
- ),
1079
1186
  push=True,
1080
1187
  registries=[docker.buildx.RegistryAuthArgs(
1081
1188
  address=ecr_repository.repository_url,
@@ -1083,6 +1190,7 @@ class Image(pulumi.CustomResource):
1083
1190
  username=auth_token.user_name,
1084
1191
  )],
1085
1192
  tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
1193
+ pulumi.export("ref", my_image.ref)
1086
1194
  ```
1087
1195
  ### Multi-platform image
1088
1196
  ```python
@@ -1114,6 +1222,7 @@ class Image(pulumi.CustomResource):
1114
1222
  username="pulumibot",
1115
1223
  )],
1116
1224
  tags=["docker.io/pulumi/pulumi:3.107.0"])
1225
+ pulumi.export("ref", my_image["ref"])
1117
1226
  ```
1118
1227
  ### Caching
1119
1228
  ```python
@@ -1121,12 +1230,12 @@ class Image(pulumi.CustomResource):
1121
1230
  import pulumi_docker as docker
1122
1231
 
1123
1232
  image = docker.buildx.Image("image",
1124
- cache_from=[docker.buildx.CacheFromEntryArgs(
1233
+ cache_from=[docker.buildx.CacheFromArgs(
1125
1234
  local=docker.buildx.CacheFromLocalArgs(
1126
1235
  src="tmp/cache",
1127
1236
  ),
1128
1237
  )],
1129
- cache_to=[docker.buildx.CacheToEntryArgs(
1238
+ cache_to=[docker.buildx.CacheToArgs(
1130
1239
  local=docker.buildx.CacheToLocalArgs(
1131
1240
  dest="tmp/cache",
1132
1241
  mode=docker.buildx/image.CacheMode.MAX,
@@ -1136,6 +1245,20 @@ class Image(pulumi.CustomResource):
1136
1245
  location="app",
1137
1246
  ))
1138
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
+ ```
1139
1262
  ### Build arguments
1140
1263
  ```python
1141
1264
  import pulumi
@@ -1149,7 +1272,7 @@ class Image(pulumi.CustomResource):
1149
1272
  location="app",
1150
1273
  ))
1151
1274
  ```
1152
- ### Build targets
1275
+ ### Build target
1153
1276
  ```python
1154
1277
  import pulumi
1155
1278
  import pulumi_docker as docker
@@ -1158,10 +1281,7 @@ class Image(pulumi.CustomResource):
1158
1281
  context=docker.buildx.BuildContextArgs(
1159
1282
  location="app",
1160
1283
  ),
1161
- targets=[
1162
- "build-me",
1163
- "also-build-me",
1164
- ])
1284
+ target="build-me")
1165
1285
  ```
1166
1286
  ### Named contexts
1167
1287
  ```python
@@ -1223,7 +1343,7 @@ class Image(pulumi.CustomResource):
1223
1343
  context=docker.buildx.BuildContextArgs(
1224
1344
  location="app",
1225
1345
  ),
1226
- exports=[docker.buildx.ExportEntryArgs(
1346
+ exports=[docker.buildx.ExportArgs(
1227
1347
  docker=docker.buildx.ExportDockerArgs(
1228
1348
  tar=True,
1229
1349
  ),
@@ -1249,11 +1369,12 @@ class Image(pulumi.CustomResource):
1249
1369
  build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1250
1370
  build_on_preview: Optional[pulumi.Input[bool]] = None,
1251
1371
  builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None,
1252
- cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromEntryArgs']]]]] = None,
1253
- cache_to: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToEntryArgs']]]]] = 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,
1254
1374
  context: Optional[pulumi.Input[pulumi.InputType['BuildContextArgs']]] = None,
1255
1375
  dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None,
1256
- exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]]] = None,
1376
+ exec_: Optional[pulumi.Input[bool]] = None,
1377
+ exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportArgs']]]]] = None,
1257
1378
  labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1258
1379
  load: Optional[pulumi.Input[bool]] = None,
1259
1380
  network: Optional[pulumi.Input['NetworkMode']] = None,
@@ -1265,7 +1386,7 @@ class Image(pulumi.CustomResource):
1265
1386
  secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
1266
1387
  ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None,
1267
1388
  tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
1268
- targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
1389
+ target: Optional[pulumi.Input[str]] = None,
1269
1390
  __props__=None):
1270
1391
  opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
1271
1392
  if not isinstance(opts, pulumi.ResourceOptions):
@@ -1283,6 +1404,7 @@ class Image(pulumi.CustomResource):
1283
1404
  __props__.__dict__["cache_to"] = cache_to
1284
1405
  __props__.__dict__["context"] = context
1285
1406
  __props__.__dict__["dockerfile"] = dockerfile
1407
+ __props__.__dict__["exec_"] = exec_
1286
1408
  __props__.__dict__["exports"] = exports
1287
1409
  __props__.__dict__["labels"] = labels
1288
1410
  __props__.__dict__["load"] = load
@@ -1297,9 +1419,9 @@ class Image(pulumi.CustomResource):
1297
1419
  __props__.__dict__["secrets"] = secrets
1298
1420
  __props__.__dict__["ssh"] = ssh
1299
1421
  __props__.__dict__["tags"] = tags
1300
- __props__.__dict__["targets"] = targets
1422
+ __props__.__dict__["target"] = target
1301
1423
  __props__.__dict__["context_hash"] = None
1302
- __props__.__dict__["digests"] = None
1424
+ __props__.__dict__["digest"] = None
1303
1425
  __props__.__dict__["ref"] = None
1304
1426
  super(Image, __self__).__init__(
1305
1427
  'docker:buildx/image:Image',
@@ -1331,8 +1453,9 @@ class Image(pulumi.CustomResource):
1331
1453
  __props__.__dict__["cache_to"] = None
1332
1454
  __props__.__dict__["context"] = None
1333
1455
  __props__.__dict__["context_hash"] = None
1334
- __props__.__dict__["digests"] = None
1456
+ __props__.__dict__["digest"] = None
1335
1457
  __props__.__dict__["dockerfile"] = None
1458
+ __props__.__dict__["exec_"] = None
1336
1459
  __props__.__dict__["exports"] = None
1337
1460
  __props__.__dict__["labels"] = None
1338
1461
  __props__.__dict__["load"] = None
@@ -1346,7 +1469,7 @@ class Image(pulumi.CustomResource):
1346
1469
  __props__.__dict__["secrets"] = None
1347
1470
  __props__.__dict__["ssh"] = None
1348
1471
  __props__.__dict__["tags"] = None
1349
- __props__.__dict__["targets"] = None
1472
+ __props__.__dict__["target"] = None
1350
1473
  return Image(resource_name, opts=opts, __props__=__props__)
1351
1474
 
1352
1475
  @property
@@ -1406,7 +1529,7 @@ class Image(pulumi.CustomResource):
1406
1529
 
1407
1530
  @property
1408
1531
  @pulumi.getter(name="cacheFrom")
1409
- def cache_from(self) -> pulumi.Output[Optional[Sequence['outputs.CacheFromEntry']]]:
1532
+ def cache_from(self) -> pulumi.Output[Optional[Sequence['outputs.CacheFrom']]]:
1410
1533
  """
1411
1534
  Cache export configuration.
1412
1535
 
@@ -1416,7 +1539,7 @@ class Image(pulumi.CustomResource):
1416
1539
 
1417
1540
  @property
1418
1541
  @pulumi.getter(name="cacheTo")
1419
- def cache_to(self) -> pulumi.Output[Optional[Sequence['outputs.CacheToEntry']]]:
1542
+ def cache_to(self) -> pulumi.Output[Optional[Sequence['outputs.CacheTo']]]:
1420
1543
  """
1421
1544
  Cache import configuration.
1422
1545
 
@@ -1446,15 +1569,17 @@ class Image(pulumi.CustomResource):
1446
1569
 
1447
1570
  @property
1448
1571
  @pulumi.getter
1449
- def digests(self) -> pulumi.Output[Mapping[str, str]]:
1572
+ def digest(self) -> pulumi.Output[str]:
1450
1573
  """
1451
- A mapping of target names to the SHA256 digest of their pushed manifest.
1574
+ A SHA256 digest of the image if it was exported to a registry or
1575
+ elsewhere.
1452
1576
 
1453
- If no target was specified 'default' is used as the target name.
1577
+ Empty if the image was not exported.
1454
1578
 
1455
- Pushed manifests can be referenced as `<tag>@<digest>`.
1579
+ Registry images can be referenced precisely as `<tag>@<digest>`. The
1580
+ `ref` output provides one such reference as a convenience.
1456
1581
  """
1457
- return pulumi.get(self, "digests")
1582
+ return pulumi.get(self, "digest")
1458
1583
 
1459
1584
  @property
1460
1585
  @pulumi.getter
@@ -1466,15 +1591,45 @@ class Image(pulumi.CustomResource):
1466
1591
  """
1467
1592
  return pulumi.get(self, "dockerfile")
1468
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
+
1469
1621
  @property
1470
1622
  @pulumi.getter
1471
- def exports(self) -> pulumi.Output[Optional[Sequence['outputs.ExportEntry']]]:
1623
+ def exports(self) -> pulumi.Output[Optional[Sequence['outputs.Export']]]:
1472
1624
  """
1473
1625
  Controls where images are persisted after building.
1474
1626
 
1475
1627
  Images are only stored in the local cache unless `exports` are
1476
1628
  explicitly configured.
1477
1629
 
1630
+ Exporting to multiple destinations requires a daemon running BuildKit
1631
+ 0.13 or later.
1632
+
1478
1633
  Equivalent to Docker's `--output` flag.
1479
1634
  """
1480
1635
  return pulumi.get(self, "exports")
@@ -1562,12 +1717,17 @@ class Image(pulumi.CustomResource):
1562
1717
  If the image was pushed to any registries then this will contain a
1563
1718
  single fully-qualified tag including the build's digest.
1564
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
+
1565
1725
  This is only for convenience and may not be appropriate for situations
1566
1726
  where multiple tags or registries are involved. In those cases this
1567
1727
  output is not guaranteed to be stable.
1568
1728
 
1569
1729
  For more control over tags consumed by downstream resources you should
1570
- use the `Digests` output.
1730
+ use the `digest` output.
1571
1731
  """
1572
1732
  return pulumi.get(self, "ref")
1573
1733
 
@@ -1626,7 +1786,7 @@ class Image(pulumi.CustomResource):
1626
1786
 
1627
1787
  @property
1628
1788
  @pulumi.getter
1629
- def targets(self) -> pulumi.Output[Optional[Sequence[str]]]:
1789
+ def target(self) -> pulumi.Output[Optional[str]]:
1630
1790
  """
1631
1791
  Set the target build stage(s) to build.
1632
1792
 
@@ -1634,5 +1794,5 @@ class Image(pulumi.CustomResource):
1634
1794
 
1635
1795
  Equivalent to Docker's `--target` flag.
1636
1796
  """
1637
- return pulumi.get(self, "targets")
1797
+ return pulumi.get(self, "target")
1638
1798