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