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