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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

@@ -0,0 +1,376 @@
1
+ # coding=utf-8
2
+ # *** WARNING: this file was generated by pulumi-language-python. ***
3
+ # *** Do not edit by hand unless you're certain you know what you are doing! ***
4
+
5
+ import copy
6
+ import warnings
7
+ import pulumi
8
+ import pulumi.runtime
9
+ from typing import Any, Mapping, Optional, Sequence, Union, overload
10
+ from . import _utilities
11
+ from . import outputs
12
+ from ._inputs import *
13
+
14
+ __all__ = ['IndexArgs', 'Index']
15
+
16
+ @pulumi.input_type
17
+ class IndexArgs:
18
+ def __init__(__self__, *,
19
+ sources: pulumi.Input[Sequence[pulumi.Input[str]]],
20
+ tag: pulumi.Input[str],
21
+ push: Optional[pulumi.Input[bool]] = None,
22
+ registry: Optional[pulumi.Input['RegistryArgs']] = None):
23
+ """
24
+ The set of arguments for constructing a Index resource.
25
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] sources: Existing images to include in the index.
26
+ :param pulumi.Input[str] tag: The tag to apply to the index.
27
+ :param pulumi.Input[bool] push: If true, push the index to the target registry.
28
+
29
+ Defaults to `true`.
30
+ :param pulumi.Input['RegistryArgs'] registry: Authentication for the registry where the tagged index will be pushed.
31
+
32
+ Credentials can also be included with the provider's configuration.
33
+ """
34
+ pulumi.set(__self__, "sources", sources)
35
+ pulumi.set(__self__, "tag", tag)
36
+ if push is None:
37
+ push = True
38
+ if push is not None:
39
+ pulumi.set(__self__, "push", push)
40
+ if registry is not None:
41
+ pulumi.set(__self__, "registry", registry)
42
+
43
+ @property
44
+ @pulumi.getter
45
+ def sources(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
46
+ """
47
+ Existing images to include in the index.
48
+ """
49
+ return pulumi.get(self, "sources")
50
+
51
+ @sources.setter
52
+ def sources(self, value: pulumi.Input[Sequence[pulumi.Input[str]]]):
53
+ pulumi.set(self, "sources", value)
54
+
55
+ @property
56
+ @pulumi.getter
57
+ def tag(self) -> pulumi.Input[str]:
58
+ """
59
+ The tag to apply to the index.
60
+ """
61
+ return pulumi.get(self, "tag")
62
+
63
+ @tag.setter
64
+ def tag(self, value: pulumi.Input[str]):
65
+ pulumi.set(self, "tag", value)
66
+
67
+ @property
68
+ @pulumi.getter
69
+ def push(self) -> Optional[pulumi.Input[bool]]:
70
+ """
71
+ If true, push the index to the target registry.
72
+
73
+ Defaults to `true`.
74
+ """
75
+ return pulumi.get(self, "push")
76
+
77
+ @push.setter
78
+ def push(self, value: Optional[pulumi.Input[bool]]):
79
+ pulumi.set(self, "push", value)
80
+
81
+ @property
82
+ @pulumi.getter
83
+ def registry(self) -> Optional[pulumi.Input['RegistryArgs']]:
84
+ """
85
+ Authentication for the registry where the tagged index will be pushed.
86
+
87
+ Credentials can also be included with the provider's configuration.
88
+ """
89
+ return pulumi.get(self, "registry")
90
+
91
+ @registry.setter
92
+ def registry(self, value: Optional[pulumi.Input['RegistryArgs']]):
93
+ pulumi.set(self, "registry", value)
94
+
95
+
96
+ class Index(pulumi.CustomResource):
97
+ @overload
98
+ def __init__(__self__,
99
+ resource_name: str,
100
+ opts: Optional[pulumi.ResourceOptions] = None,
101
+ push: Optional[pulumi.Input[bool]] = None,
102
+ registry: Optional[pulumi.Input[pulumi.InputType['RegistryArgs']]] = None,
103
+ sources: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
104
+ tag: Optional[pulumi.Input[str]] = None,
105
+ __props__=None):
106
+ """
107
+ A wrapper around `docker buildx imagetools create` to create an index
108
+ (or manifest list) referencing one or more existing images.
109
+
110
+ In most cases you do not need an `Index` to build a multi-platform
111
+ image -- specifying multiple platforms on the `Image` will handle this
112
+ for you automatically.
113
+
114
+ However, as of April 2024, building multi-platform images _with
115
+ caching_ will only export a cache for one platform at a time (see [this
116
+ discussion](https://github.com/docker/buildx/discussions/1382) for more
117
+ details).
118
+
119
+ Therefore this resource can be helpful if you are building
120
+ multi-platform images with caching: each platform can be built and
121
+ cached separately, and an `Index` can join them all together. An
122
+ example of this is shown below.
123
+
124
+ This resource creates an OCI image index or a Docker manifest list
125
+ depending on the media types of the source images.
126
+
127
+ ## Example Usage
128
+ ### Multi-platform registry caching
129
+ ```python
130
+ import pulumi
131
+ import pulumi_docker_build as docker_build
132
+
133
+ amd64 = docker_build.Image("amd64",
134
+ cache_from=[docker_build.CacheFromArgs(
135
+ registry=docker_build.CacheFromRegistryArgs(
136
+ ref="docker.io/pulumi/pulumi:cache-amd64",
137
+ ),
138
+ )],
139
+ cache_to=[docker_build.CacheToArgs(
140
+ registry=docker_build.CacheToRegistryArgs(
141
+ mode=docker_build.CacheMode.MAX,
142
+ ref="docker.io/pulumi/pulumi:cache-amd64",
143
+ ),
144
+ )],
145
+ context=docker_build.BuildContextArgs(
146
+ location="app",
147
+ ),
148
+ platforms=[docker_build.Platform.LINUX_AMD64],
149
+ tags=["docker.io/pulumi/pulumi:3.107.0-amd64"])
150
+ arm64 = docker_build.Image("arm64",
151
+ cache_from=[docker_build.CacheFromArgs(
152
+ registry=docker_build.CacheFromRegistryArgs(
153
+ ref="docker.io/pulumi/pulumi:cache-arm64",
154
+ ),
155
+ )],
156
+ cache_to=[docker_build.CacheToArgs(
157
+ registry=docker_build.CacheToRegistryArgs(
158
+ mode=docker_build.CacheMode.MAX,
159
+ ref="docker.io/pulumi/pulumi:cache-arm64",
160
+ ),
161
+ )],
162
+ context=docker_build.BuildContextArgs(
163
+ location="app",
164
+ ),
165
+ platforms=[docker_build.Platform.LINUX_ARM64],
166
+ tags=["docker.io/pulumi/pulumi:3.107.0-arm64"])
167
+ index = docker_build.Index("index",
168
+ sources=[
169
+ amd64.ref,
170
+ arm64.ref,
171
+ ],
172
+ tag="docker.io/pulumi/pulumi:3.107.0")
173
+ pulumi.export("ref", index.ref)
174
+ ```
175
+
176
+ :param str resource_name: The name of the resource.
177
+ :param pulumi.ResourceOptions opts: Options for the resource.
178
+ :param pulumi.Input[bool] push: If true, push the index to the target registry.
179
+
180
+ Defaults to `true`.
181
+ :param pulumi.Input[pulumi.InputType['RegistryArgs']] registry: Authentication for the registry where the tagged index will be pushed.
182
+
183
+ Credentials can also be included with the provider's configuration.
184
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] sources: Existing images to include in the index.
185
+ :param pulumi.Input[str] tag: The tag to apply to the index.
186
+ """
187
+ ...
188
+ @overload
189
+ def __init__(__self__,
190
+ resource_name: str,
191
+ args: IndexArgs,
192
+ opts: Optional[pulumi.ResourceOptions] = None):
193
+ """
194
+ A wrapper around `docker buildx imagetools create` to create an index
195
+ (or manifest list) referencing one or more existing images.
196
+
197
+ In most cases you do not need an `Index` to build a multi-platform
198
+ image -- specifying multiple platforms on the `Image` will handle this
199
+ for you automatically.
200
+
201
+ However, as of April 2024, building multi-platform images _with
202
+ caching_ will only export a cache for one platform at a time (see [this
203
+ discussion](https://github.com/docker/buildx/discussions/1382) for more
204
+ details).
205
+
206
+ Therefore this resource can be helpful if you are building
207
+ multi-platform images with caching: each platform can be built and
208
+ cached separately, and an `Index` can join them all together. An
209
+ example of this is shown below.
210
+
211
+ This resource creates an OCI image index or a Docker manifest list
212
+ depending on the media types of the source images.
213
+
214
+ ## Example Usage
215
+ ### Multi-platform registry caching
216
+ ```python
217
+ import pulumi
218
+ import pulumi_docker_build as docker_build
219
+
220
+ amd64 = docker_build.Image("amd64",
221
+ cache_from=[docker_build.CacheFromArgs(
222
+ registry=docker_build.CacheFromRegistryArgs(
223
+ ref="docker.io/pulumi/pulumi:cache-amd64",
224
+ ),
225
+ )],
226
+ cache_to=[docker_build.CacheToArgs(
227
+ registry=docker_build.CacheToRegistryArgs(
228
+ mode=docker_build.CacheMode.MAX,
229
+ ref="docker.io/pulumi/pulumi:cache-amd64",
230
+ ),
231
+ )],
232
+ context=docker_build.BuildContextArgs(
233
+ location="app",
234
+ ),
235
+ platforms=[docker_build.Platform.LINUX_AMD64],
236
+ tags=["docker.io/pulumi/pulumi:3.107.0-amd64"])
237
+ arm64 = docker_build.Image("arm64",
238
+ cache_from=[docker_build.CacheFromArgs(
239
+ registry=docker_build.CacheFromRegistryArgs(
240
+ ref="docker.io/pulumi/pulumi:cache-arm64",
241
+ ),
242
+ )],
243
+ cache_to=[docker_build.CacheToArgs(
244
+ registry=docker_build.CacheToRegistryArgs(
245
+ mode=docker_build.CacheMode.MAX,
246
+ ref="docker.io/pulumi/pulumi:cache-arm64",
247
+ ),
248
+ )],
249
+ context=docker_build.BuildContextArgs(
250
+ location="app",
251
+ ),
252
+ platforms=[docker_build.Platform.LINUX_ARM64],
253
+ tags=["docker.io/pulumi/pulumi:3.107.0-arm64"])
254
+ index = docker_build.Index("index",
255
+ sources=[
256
+ amd64.ref,
257
+ arm64.ref,
258
+ ],
259
+ tag="docker.io/pulumi/pulumi:3.107.0")
260
+ pulumi.export("ref", index.ref)
261
+ ```
262
+
263
+ :param str resource_name: The name of the resource.
264
+ :param IndexArgs args: The arguments to use to populate this resource's properties.
265
+ :param pulumi.ResourceOptions opts: Options for the resource.
266
+ """
267
+ ...
268
+ def __init__(__self__, resource_name: str, *args, **kwargs):
269
+ resource_args, opts = _utilities.get_resource_args_opts(IndexArgs, pulumi.ResourceOptions, *args, **kwargs)
270
+ if resource_args is not None:
271
+ __self__._internal_init(resource_name, opts, **resource_args.__dict__)
272
+ else:
273
+ __self__._internal_init(resource_name, *args, **kwargs)
274
+
275
+ def _internal_init(__self__,
276
+ resource_name: str,
277
+ opts: Optional[pulumi.ResourceOptions] = None,
278
+ push: Optional[pulumi.Input[bool]] = None,
279
+ registry: Optional[pulumi.Input[pulumi.InputType['RegistryArgs']]] = None,
280
+ sources: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
281
+ tag: Optional[pulumi.Input[str]] = None,
282
+ __props__=None):
283
+ opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
284
+ if not isinstance(opts, pulumi.ResourceOptions):
285
+ raise TypeError('Expected resource options to be a ResourceOptions instance')
286
+ if opts.id is None:
287
+ if __props__ is not None:
288
+ raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
289
+ __props__ = IndexArgs.__new__(IndexArgs)
290
+
291
+ if push is None:
292
+ push = True
293
+ __props__.__dict__["push"] = push
294
+ __props__.__dict__["registry"] = registry
295
+ if sources is None and not opts.urn:
296
+ raise TypeError("Missing required property 'sources'")
297
+ __props__.__dict__["sources"] = sources
298
+ if tag is None and not opts.urn:
299
+ raise TypeError("Missing required property 'tag'")
300
+ __props__.__dict__["tag"] = tag
301
+ __props__.__dict__["ref"] = None
302
+ super(Index, __self__).__init__(
303
+ 'docker-build:index:Index',
304
+ resource_name,
305
+ __props__,
306
+ opts)
307
+
308
+ @staticmethod
309
+ def get(resource_name: str,
310
+ id: pulumi.Input[str],
311
+ opts: Optional[pulumi.ResourceOptions] = None) -> 'Index':
312
+ """
313
+ Get an existing Index resource's state with the given name, id, and optional extra
314
+ properties used to qualify the lookup.
315
+
316
+ :param str resource_name: The unique name of the resulting resource.
317
+ :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
318
+ :param pulumi.ResourceOptions opts: Options for the resource.
319
+ """
320
+ opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
321
+
322
+ __props__ = IndexArgs.__new__(IndexArgs)
323
+
324
+ __props__.__dict__["push"] = None
325
+ __props__.__dict__["ref"] = None
326
+ __props__.__dict__["registry"] = None
327
+ __props__.__dict__["sources"] = None
328
+ __props__.__dict__["tag"] = None
329
+ return Index(resource_name, opts=opts, __props__=__props__)
330
+
331
+ @property
332
+ @pulumi.getter
333
+ def push(self) -> pulumi.Output[Optional[bool]]:
334
+ """
335
+ If true, push the index to the target registry.
336
+
337
+ Defaults to `true`.
338
+ """
339
+ return pulumi.get(self, "push")
340
+
341
+ @property
342
+ @pulumi.getter
343
+ def ref(self) -> pulumi.Output[str]:
344
+ """
345
+ The pushed tag with digest.
346
+
347
+ Identical to the tag if the index was not pushed.
348
+ """
349
+ return pulumi.get(self, "ref")
350
+
351
+ @property
352
+ @pulumi.getter
353
+ def registry(self) -> pulumi.Output[Optional['outputs.Registry']]:
354
+ """
355
+ Authentication for the registry where the tagged index will be pushed.
356
+
357
+ Credentials can also be included with the provider's configuration.
358
+ """
359
+ return pulumi.get(self, "registry")
360
+
361
+ @property
362
+ @pulumi.getter
363
+ def sources(self) -> pulumi.Output[Sequence[str]]:
364
+ """
365
+ Existing images to include in the index.
366
+ """
367
+ return pulumi.get(self, "sources")
368
+
369
+ @property
370
+ @pulumi.getter
371
+ def tag(self) -> pulumi.Output[str]:
372
+ """
373
+ The tag to apply to the index.
374
+ """
375
+ return pulumi.get(self, "tag")
376
+