// *** WARNING: this file was generated by pulumi-language-dotnet. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.DockerBuild { /// /// A Docker image built using buildx -- Docker's interface to the improved /// BuildKit backend. /// /// ## Stability /// /// **This resource is pre-1.0 and in public preview.** /// /// We will strive to keep APIs and behavior as stable as possible, but we /// cannot guarantee stability until version 1.0. /// /// ## Migrating Pulumi Docker v3 and v4 Image resources /// /// 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. /// Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications. /// /// ### Behavioral differences /// /// There are several key behavioral differences to keep in mind when transitioning images to the new `Image` resource. /// /// #### Previews /// /// Version `3.x` of the Pulumi Docker provider always builds images during preview operations. /// 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. /// /// Version `4.x` changed build-on-preview behavior to be opt-in. /// By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option. /// Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI. /// /// The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews. /// This behavior can be changed by specifying `buildOnPreview`. /// /// #### Push behavior /// /// Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default. /// They expose a `skipPush: true` option to disable pushing. /// /// This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default. /// /// 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`). /// 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. /// /// #### Secrets /// /// Version `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field. /// /// Version `4.x` of the Pulumi Docker provider does not support secrets. /// /// The `Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables. /// Instead, they should be passed directly as values. /// (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).) /// Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments. /// /// #### Caching /// /// Version `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`. /// It builds targets individually and pushes them to separate images for caching. /// /// Version `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches. /// /// Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior. /// This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc. /// /// The `Image` resource delegates all caching behavior to Docker. /// `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. /// /// #### Outputs /// /// Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest. /// In `4.x` this could also be a single sha256 hash if the image wasn't pushed. /// /// Unlike earlier providers the `Image` resource can push multiple tags. /// As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed. /// If multiple tags were pushed this uses one at random. /// /// 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. /// /// #### Tag deletion and refreshes /// /// 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. /// /// The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist. /// If any are missing a subsequent `update` will push them. /// /// When a `Image` is deleted, it will _attempt_ to also delete any pushed tags. /// Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular). /// 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. /// /// Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted. /// /// ### Example migration /// /// 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. /// /// The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`. /// After migration, the environment variable is no longer needed and CLI flags are now properties on the `Image`. /// In almost all cases, properties of `Image` are named after the Docker CLI flag they correspond to. /// /// The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`. /// It it is shown with parameters similar to the `v3` example for completeness. /// /// ## Example Usage /// /// ## Example Usage /// ### Push to AWS ECR with caching /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using Aws = Pulumi.Aws; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var ecrRepository = new Aws.Ecr.Repository("ecr-repository"); /// /// var authToken = Aws.Ecr.GetAuthorizationToken.Invoke(new() /// { /// RegistryId = ecrRepository.RegistryId, /// }); /// /// var myImage = new DockerBuild.Image("my-image", new() /// { /// CacheFrom = new[] /// { /// new DockerBuild.Inputs.CacheFromArgs /// { /// Registry = new DockerBuild.Inputs.CacheFromRegistryArgs /// { /// Ref = ecrRepository.RepositoryUrl.Apply(repositoryUrl => $"{repositoryUrl}:cache"), /// }, /// }, /// }, /// CacheTo = new[] /// { /// new DockerBuild.Inputs.CacheToArgs /// { /// Registry = new DockerBuild.Inputs.CacheToRegistryArgs /// { /// ImageManifest = true, /// OciMediaTypes = true, /// Ref = ecrRepository.RepositoryUrl.Apply(repositoryUrl => $"{repositoryUrl}:cache"), /// }, /// }, /// }, /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "./app", /// }, /// Push = true, /// Registries = new[] /// { /// new DockerBuild.Inputs.RegistryArgs /// { /// Address = ecrRepository.RepositoryUrl, /// Password = authToken.Apply(getAuthorizationTokenResult => getAuthorizationTokenResult.Password), /// Username = authToken.Apply(getAuthorizationTokenResult => getAuthorizationTokenResult.UserName), /// }, /// }, /// Tags = new[] /// { /// ecrRepository.RepositoryUrl.Apply(repositoryUrl => $"{repositoryUrl}:latest"), /// }, /// }); /// /// return new Dictionary<string, object?> /// { /// ["ref"] = myImage.Ref, /// }; /// }); /// /// ``` /// ### Multi-platform image /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Platforms = new[] /// { /// DockerBuild.Platform.Plan9_amd64, /// DockerBuild.Platform.Plan9_386, /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Registry export /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Push = true, /// Registries = new[] /// { /// new DockerBuild.Inputs.RegistryArgs /// { /// Address = "docker.io", /// Password = dockerHubPassword, /// Username = "pulumibot", /// }, /// }, /// Tags = new[] /// { /// "docker.io/pulumi/pulumi:3.107.0", /// }, /// }); /// /// return new Dictionary<string, object?> /// { /// ["ref"] = myImage.Ref, /// }; /// }); /// /// ``` /// ### Caching /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// CacheFrom = new[] /// { /// new DockerBuild.Inputs.CacheFromArgs /// { /// Local = new DockerBuild.Inputs.CacheFromLocalArgs /// { /// Src = "tmp/cache", /// }, /// }, /// }, /// CacheTo = new[] /// { /// new DockerBuild.Inputs.CacheToArgs /// { /// Local = new DockerBuild.Inputs.CacheToLocalArgs /// { /// Dest = "tmp/cache", /// Mode = DockerBuild.CacheMode.Max, /// }, /// }, /// }, /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Docker Build Cloud /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Builder = new DockerBuild.Inputs.BuilderConfigArgs /// { /// Name = "cloud-builder-name", /// }, /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Exec = true, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Build arguments /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// BuildArgs = /// { /// { "SET_ME_TO_TRUE", "true" }, /// }, /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Build target /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Push = false, /// Target = "build-me", /// }); /// /// }); /// /// ``` /// ### Named contexts /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// Named = /// { /// { "golang:latest", new DockerBuild.Inputs.ContextArgs /// { /// Location = "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984", /// } }, /// }, /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Remote context /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile", /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Inline Dockerfile /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Dockerfile = new DockerBuild.Inputs.DockerfileArgs /// { /// Inline = @"FROM busybox /// COPY hello.c ./ /// ", /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Remote context /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "https://github.com/docker-library/hello-world.git", /// }, /// Dockerfile = new DockerBuild.Inputs.DockerfileArgs /// { /// Location = "app/Dockerfile", /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// ### Local export /// ```csharp /// using System.Collections.Generic; /// using System.Linq; /// using Pulumi; /// using DockerBuild = Pulumi.DockerBuild; /// /// return await Deployment.RunAsync(() => /// { /// var image = new DockerBuild.Image("image", new() /// { /// Context = new DockerBuild.Inputs.BuildContextArgs /// { /// Location = "app", /// }, /// Exports = new[] /// { /// new DockerBuild.Inputs.ExportArgs /// { /// Docker = new DockerBuild.Inputs.ExportDockerArgs /// { /// Tar = true, /// }, /// }, /// }, /// Push = false, /// }); /// /// }); /// /// ``` /// [DockerBuildResourceType("docker-build:index:Image")] public partial class Image : global::Pulumi.CustomResource { /// /// Custom `host:ip` mappings to use during the build. /// /// Equivalent to Docker's `--add-host` flag. /// [Output("addHosts")] public Output> AddHosts { get; private set; } = null!; /// /// `ARG` names and values to set during the build. /// /// These variables are accessed like environment variables inside `RUN` /// instructions. /// /// Build arguments are persisted in the image, so you should use `secrets` /// if these arguments are sensitive. /// /// Equivalent to Docker's `--build-arg` flag. /// [Output("buildArgs")] public Output?> BuildArgs { get; private set; } = null!; /// /// Setting this to `false` will always skip image builds during previews, /// and setting it to `true` will always build images during previews. /// /// Images built during previews are never exported to registries, however /// cache manifests are still exported. /// /// On-disk Dockerfiles are always validated for syntactic correctness /// regardless of this setting. /// /// Defaults to `true` as a safeguard against broken images merging as part /// of CI pipelines. /// [Output("buildOnPreview")] public Output BuildOnPreview { get; private set; } = null!; /// /// Builder configuration. /// [Output("builder")] public Output Builder { get; private set; } = null!; /// /// Cache export configuration. /// /// Equivalent to Docker's `--cache-from` flag. /// [Output("cacheFrom")] public Output> CacheFrom { get; private set; } = null!; /// /// Cache import configuration. /// /// Equivalent to Docker's `--cache-to` flag. /// [Output("cacheTo")] public Output> CacheTo { get; private set; } = null!; /// /// Build context settings. Defaults to the current directory. /// /// Equivalent to Docker's `PATH | URL | -` positional argument. /// [Output("context")] public Output Context { get; private set; } = null!; /// /// A preliminary hash of the image's build context. /// /// Pulumi uses this to determine if an image _may_ need to be re-built. /// [Output("contextHash")] public Output ContextHash { get; private set; } = null!; /// /// A SHA256 digest of the image if it was exported to a registry or /// elsewhere. /// /// Empty if the image was not exported. /// /// Registry images can be referenced precisely as `<tag>@<digest>`. The /// `ref` output provides one such reference as a convenience. /// [Output("digest")] public Output Digest { get; private set; } = null!; /// /// Dockerfile settings. /// /// Equivalent to Docker's `--file` flag. /// [Output("dockerfile")] public Output Dockerfile { get; private set; } = null!; /// /// Use `exec` mode to build this image. /// /// By default the provider embeds a v25 Docker client with v0.12 buildx /// support. This helps ensure consistent behavior across environments and /// is compatible with alternative build backends (e.g. `buildkitd`), but /// it may not be desirable if you require a specific version of buildx. /// For example you may want to run a custom `docker-buildx` binary with /// support for [Docker Build /// Cloud](https://docs.docker.com/build/cloud/setup/) (DBC). /// /// When this is set to `true` the provider will instead execute the /// `docker-buildx` binary directly to perform its operations. The user is /// responsible for ensuring this binary exists, with correct permissions /// and pre-configured builders, at a path Docker expects (e.g. /// `~/.docker/cli-plugins`). /// /// Debugging `exec` mode may be more difficult as Pulumi will not be able /// to surface fine-grained errors and warnings. Additionally credentials /// are temporarily written to disk in order to provide them to the /// `docker-buildx` binary. /// [Output("exec")] public Output Exec { get; private set; } = null!; /// /// Controls where images are persisted after building. /// /// Images are only stored in the local cache unless `exports` are /// explicitly configured. /// /// Exporting to multiple destinations requires a daemon running BuildKit /// 0.13 or later. /// /// Equivalent to Docker's `--output` flag. /// [Output("exports")] public Output> Exports { get; private set; } = null!; /// /// Attach arbitrary key/value metadata to the image. /// /// Equivalent to Docker's `--label` flag. /// [Output("labels")] public Output?> Labels { get; private set; } = null!; /// /// When `true` the build will automatically include a `docker` export. /// /// Defaults to `false`. /// /// Equivalent to Docker's `--load` flag. /// [Output("load")] public Output Load { get; private set; } = null!; /// /// Set the network mode for `RUN` instructions. Defaults to `default`. /// /// For custom networks, configure your builder with `--driver-opt network=...`. /// /// Equivalent to Docker's `--network` flag. /// [Output("network")] public Output Network { get; private set; } = null!; /// /// Do not import cache manifests when building the image. /// /// Equivalent to Docker's `--no-cache` flag. /// [Output("noCache")] public Output NoCache { get; private set; } = null!; /// /// Set target platform(s) for the build. Defaults to the host's platform. /// /// Equivalent to Docker's `--platform` flag. /// [Output("platforms")] public Output> Platforms { get; private set; } = null!; /// /// Always pull referenced images. /// /// Equivalent to Docker's `--pull` flag. /// [Output("pull")] public Output Pull { get; private set; } = null!; /// /// When `true` the build will automatically include a `registry` export. /// /// Defaults to `false`. /// /// Equivalent to Docker's `--push` flag. /// [Output("push")] public Output Push { get; private set; } = null!; /// /// If the image was pushed to any registries then this will contain a /// single fully-qualified tag including the build's digest. /// /// If the image had tags but was not exported, this will take on a value /// of one of those tags. /// /// This will be empty if the image had no exports and no tags. /// /// This is only for convenience and may not be appropriate for situations /// where multiple tags or registries are involved. In those cases this /// output is not guaranteed to be stable. /// /// For more control over tags consumed by downstream resources you should /// use the `digest` output. /// [Output("ref")] public Output Ref { get; private set; } = null!; /// /// Registry credentials. Required if reading or exporting to private /// repositories. /// /// Credentials are kept in-memory and do not pollute pre-existing /// credentials on the host. /// /// Similar to `docker login`. /// [Output("registries")] public Output> Registries { get; private set; } = null!; /// /// A mapping of secret names to their corresponding values. /// /// Unlike the Docker CLI, these can be passed by value and do not need to /// exist on-disk or in environment variables. /// /// Build arguments and environment variables are persistent in the final /// image, so you should use this for sensitive values. /// /// Similar to Docker's `--secret` flag. /// [Output("secrets")] public Output?> Secrets { get; private set; } = null!; /// /// SSH agent socket or keys to expose to the build. /// /// Equivalent to Docker's `--ssh` flag. /// [Output("ssh")] public Output> Ssh { get; private set; } = null!; /// /// Name and optionally a tag (format: `name:tag`). /// /// If exporting to a registry, the name should include the fully qualified /// registry address (e.g. `docker.io/pulumi/pulumi:latest`). /// /// Equivalent to Docker's `--tag` flag. /// [Output("tags")] public Output> Tags { get; private set; } = null!; /// /// Set the target build stage(s) to build. /// /// If not specified all targets will be built by default. /// /// Equivalent to Docker's `--target` flag. /// [Output("target")] public Output Target { get; private set; } = null!; /// /// Create a Image resource with the given unique name, arguments, and options. /// /// /// The unique name of the resource /// The arguments used to populate this resource's properties /// A bag of options that control this resource's behavior public Image(string name, ImageArgs args, CustomResourceOptions? options = null) : base("docker-build:index:Image", name, args ?? new ImageArgs(), MakeResourceOptions(options, "")) { } private Image(string name, Input id, CustomResourceOptions? options = null) : base("docker-build:index:Image", name, null, MakeResourceOptions(options, id)) { } private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input? id) { var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. merged.Id = id ?? merged.Id; return merged; } /// /// Get an existing Image resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// /// /// The unique name of the resulting resource. /// The unique provider ID of the resource to lookup. /// A bag of options that control this resource's behavior public static Image Get(string name, Input id, CustomResourceOptions? options = null) { return new Image(name, id, options); } } public sealed class ImageArgs : global::Pulumi.ResourceArgs { [Input("addHosts")] private InputList? _addHosts; /// /// Custom `host:ip` mappings to use during the build. /// /// Equivalent to Docker's `--add-host` flag. /// public InputList AddHosts { get => _addHosts ?? (_addHosts = new InputList()); set => _addHosts = value; } [Input("buildArgs")] private InputMap? _buildArgs; /// /// `ARG` names and values to set during the build. /// /// These variables are accessed like environment variables inside `RUN` /// instructions. /// /// Build arguments are persisted in the image, so you should use `secrets` /// if these arguments are sensitive. /// /// Equivalent to Docker's `--build-arg` flag. /// public InputMap BuildArgs { get => _buildArgs ?? (_buildArgs = new InputMap()); set => _buildArgs = value; } /// /// Setting this to `false` will always skip image builds during previews, /// and setting it to `true` will always build images during previews. /// /// Images built during previews are never exported to registries, however /// cache manifests are still exported. /// /// On-disk Dockerfiles are always validated for syntactic correctness /// regardless of this setting. /// /// Defaults to `true` as a safeguard against broken images merging as part /// of CI pipelines. /// [Input("buildOnPreview")] public Input? BuildOnPreview { get; set; } /// /// Builder configuration. /// [Input("builder")] public Input? Builder { get; set; } [Input("cacheFrom")] private InputList? _cacheFrom; /// /// Cache export configuration. /// /// Equivalent to Docker's `--cache-from` flag. /// public InputList CacheFrom { get => _cacheFrom ?? (_cacheFrom = new InputList()); set => _cacheFrom = value; } [Input("cacheTo")] private InputList? _cacheTo; /// /// Cache import configuration. /// /// Equivalent to Docker's `--cache-to` flag. /// public InputList CacheTo { get => _cacheTo ?? (_cacheTo = new InputList()); set => _cacheTo = value; } /// /// Build context settings. Defaults to the current directory. /// /// Equivalent to Docker's `PATH | URL | -` positional argument. /// [Input("context")] public Input? Context { get; set; } /// /// Dockerfile settings. /// /// Equivalent to Docker's `--file` flag. /// [Input("dockerfile")] public Input? Dockerfile { get; set; } /// /// Use `exec` mode to build this image. /// /// By default the provider embeds a v25 Docker client with v0.12 buildx /// support. This helps ensure consistent behavior across environments and /// is compatible with alternative build backends (e.g. `buildkitd`), but /// it may not be desirable if you require a specific version of buildx. /// For example you may want to run a custom `docker-buildx` binary with /// support for [Docker Build /// Cloud](https://docs.docker.com/build/cloud/setup/) (DBC). /// /// When this is set to `true` the provider will instead execute the /// `docker-buildx` binary directly to perform its operations. The user is /// responsible for ensuring this binary exists, with correct permissions /// and pre-configured builders, at a path Docker expects (e.g. /// `~/.docker/cli-plugins`). /// /// Debugging `exec` mode may be more difficult as Pulumi will not be able /// to surface fine-grained errors and warnings. Additionally credentials /// are temporarily written to disk in order to provide them to the /// `docker-buildx` binary. /// [Input("exec")] public Input? Exec { get; set; } [Input("exports")] private InputList? _exports; /// /// Controls where images are persisted after building. /// /// Images are only stored in the local cache unless `exports` are /// explicitly configured. /// /// Exporting to multiple destinations requires a daemon running BuildKit /// 0.13 or later. /// /// Equivalent to Docker's `--output` flag. /// public InputList Exports { get => _exports ?? (_exports = new InputList()); set => _exports = value; } [Input("labels")] private InputMap? _labels; /// /// Attach arbitrary key/value metadata to the image. /// /// Equivalent to Docker's `--label` flag. /// public InputMap Labels { get => _labels ?? (_labels = new InputMap()); set => _labels = value; } /// /// When `true` the build will automatically include a `docker` export. /// /// Defaults to `false`. /// /// Equivalent to Docker's `--load` flag. /// [Input("load")] public Input? Load { get; set; } /// /// Set the network mode for `RUN` instructions. Defaults to `default`. /// /// For custom networks, configure your builder with `--driver-opt network=...`. /// /// Equivalent to Docker's `--network` flag. /// [Input("network")] public Input? Network { get; set; } /// /// Do not import cache manifests when building the image. /// /// Equivalent to Docker's `--no-cache` flag. /// [Input("noCache")] public Input? NoCache { get; set; } [Input("platforms")] private InputList? _platforms; /// /// Set target platform(s) for the build. Defaults to the host's platform. /// /// Equivalent to Docker's `--platform` flag. /// public InputList Platforms { get => _platforms ?? (_platforms = new InputList()); set => _platforms = value; } /// /// Always pull referenced images. /// /// Equivalent to Docker's `--pull` flag. /// [Input("pull")] public Input? Pull { get; set; } /// /// When `true` the build will automatically include a `registry` export. /// /// Defaults to `false`. /// /// Equivalent to Docker's `--push` flag. /// [Input("push", required: true)] public Input Push { get; set; } = null!; [Input("registries")] private InputList? _registries; /// /// Registry credentials. Required if reading or exporting to private /// repositories. /// /// Credentials are kept in-memory and do not pollute pre-existing /// credentials on the host. /// /// Similar to `docker login`. /// public InputList Registries { get => _registries ?? (_registries = new InputList()); set => _registries = value; } [Input("secrets")] private InputMap? _secrets; /// /// A mapping of secret names to their corresponding values. /// /// Unlike the Docker CLI, these can be passed by value and do not need to /// exist on-disk or in environment variables. /// /// Build arguments and environment variables are persistent in the final /// image, so you should use this for sensitive values. /// /// Similar to Docker's `--secret` flag. /// public InputMap Secrets { get => _secrets ?? (_secrets = new InputMap()); set => _secrets = value; } [Input("ssh")] private InputList? _ssh; /// /// SSH agent socket or keys to expose to the build. /// /// Equivalent to Docker's `--ssh` flag. /// public InputList Ssh { get => _ssh ?? (_ssh = new InputList()); set => _ssh = value; } [Input("tags")] private InputList? _tags; /// /// Name and optionally a tag (format: `name:tag`). /// /// If exporting to a registry, the name should include the fully qualified /// registry address (e.g. `docker.io/pulumi/pulumi:latest`). /// /// Equivalent to Docker's `--tag` flag. /// public InputList Tags { get => _tags ?? (_tags = new InputList()); set => _tags = value; } /// /// Set the target build stage(s) to build. /// /// If not specified all targets will be built by default. /// /// Equivalent to Docker's `--target` flag. /// [Input("target")] public Input? Target { get; set; } public ImageArgs() { BuildOnPreview = true; Network = Pulumi.DockerBuild.NetworkMode.@Default; } public static new ImageArgs Empty => new ImageArgs(); } }