All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.dockerbuild.ImageArgs Maven / Gradle / Ivy

Go to download

A Pulumi provider for building modern Docker images with buildx and BuildKit.

There is a newer version: 0.1.0-alpha.1729468870
Show newest version
// *** WARNING: this file was generated by pulumi. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.dockerbuild;

import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import com.pulumi.core.internal.Codegen;
import com.pulumi.dockerbuild.enums.NetworkMode;
import com.pulumi.dockerbuild.enums.Platform;
import com.pulumi.dockerbuild.inputs.BuildContextArgs;
import com.pulumi.dockerbuild.inputs.BuilderConfigArgs;
import com.pulumi.dockerbuild.inputs.CacheFromArgs;
import com.pulumi.dockerbuild.inputs.CacheToArgs;
import com.pulumi.dockerbuild.inputs.DockerfileArgs;
import com.pulumi.dockerbuild.inputs.ExportArgs;
import com.pulumi.dockerbuild.inputs.RegistryArgs;
import com.pulumi.dockerbuild.inputs.SSHArgs;
import com.pulumi.exceptions.MissingRequiredPropertyException;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;


public final class ImageArgs extends com.pulumi.resources.ResourceArgs {

    public static final ImageArgs Empty = new ImageArgs();

    /**
     * Custom `host:ip` mappings to use during the build.
     * 
     * Equivalent to Docker's `--add-host` flag.
     * 
     */
    @Import(name="addHosts")
    private @Nullable Output> addHosts;

    /**
     * @return Custom `host:ip` mappings to use during the build.
     * 
     * Equivalent to Docker's `--add-host` flag.
     * 
     */
    public Optional>> addHosts() {
        return Optional.ofNullable(this.addHosts);
    }

    /**
     * `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.
     * 
     */
    @Import(name="buildArgs")
    private @Nullable Output> buildArgs;

    /**
     * @return `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 Optional>> buildArgs() {
        return Optional.ofNullable(this.buildArgs);
    }

    /**
     * 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.
     * 
     */
    @Import(name="buildOnPreview")
    private @Nullable Output buildOnPreview;

    /**
     * @return 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.
     * 
     */
    public Optional> buildOnPreview() {
        return Optional.ofNullable(this.buildOnPreview);
    }

    /**
     * Builder configuration.
     * 
     */
    @Import(name="builder")
    private @Nullable Output builder;

    /**
     * @return Builder configuration.
     * 
     */
    public Optional> builder_() {
        return Optional.ofNullable(this.builder);
    }

    /**
     * Cache export configuration.
     * 
     * Equivalent to Docker's `--cache-from` flag.
     * 
     */
    @Import(name="cacheFrom")
    private @Nullable Output> cacheFrom;

    /**
     * @return Cache export configuration.
     * 
     * Equivalent to Docker's `--cache-from` flag.
     * 
     */
    public Optional>> cacheFrom() {
        return Optional.ofNullable(this.cacheFrom);
    }

    /**
     * Cache import configuration.
     * 
     * Equivalent to Docker's `--cache-to` flag.
     * 
     */
    @Import(name="cacheTo")
    private @Nullable Output> cacheTo;

    /**
     * @return Cache import configuration.
     * 
     * Equivalent to Docker's `--cache-to` flag.
     * 
     */
    public Optional>> cacheTo() {
        return Optional.ofNullable(this.cacheTo);
    }

    /**
     * Build context settings. Defaults to the current directory.
     * 
     * Equivalent to Docker's `PATH | URL | -` positional argument.
     * 
     */
    @Import(name="context")
    private @Nullable Output context;

    /**
     * @return Build context settings. Defaults to the current directory.
     * 
     * Equivalent to Docker's `PATH | URL | -` positional argument.
     * 
     */
    public Optional> context() {
        return Optional.ofNullable(this.context);
    }

    /**
     * Dockerfile settings.
     * 
     * Equivalent to Docker's `--file` flag.
     * 
     */
    @Import(name="dockerfile")
    private @Nullable Output dockerfile;

    /**
     * @return Dockerfile settings.
     * 
     * Equivalent to Docker's `--file` flag.
     * 
     */
    public Optional> dockerfile() {
        return Optional.ofNullable(this.dockerfile);
    }

    /**
     * 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.
     * 
     */
    @Import(name="exec")
    private @Nullable Output exec;

    /**
     * @return 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.
     * 
     */
    public Optional> exec() {
        return Optional.ofNullable(this.exec);
    }

    /**
     * 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.
     * 
     */
    @Import(name="exports")
    private @Nullable Output> exports;

    /**
     * @return 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 Optional>> exports() {
        return Optional.ofNullable(this.exports);
    }

    /**
     * Attach arbitrary key/value metadata to the image.
     * 
     * Equivalent to Docker's `--label` flag.
     * 
     */
    @Import(name="labels")
    private @Nullable Output> labels;

    /**
     * @return Attach arbitrary key/value metadata to the image.
     * 
     * Equivalent to Docker's `--label` flag.
     * 
     */
    public Optional>> labels() {
        return Optional.ofNullable(this.labels);
    }

    /**
     * When `true` the build will automatically include a `docker` export.
     * 
     * Defaults to `false`.
     * 
     * Equivalent to Docker's `--load` flag.
     * 
     */
    @Import(name="load")
    private @Nullable Output load;

    /**
     * @return When `true` the build will automatically include a `docker` export.
     * 
     * Defaults to `false`.
     * 
     * Equivalent to Docker's `--load` flag.
     * 
     */
    public Optional> load() {
        return Optional.ofNullable(this.load);
    }

    /**
     * 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.
     * 
     */
    @Import(name="network")
    private @Nullable Output network;

    /**
     * @return 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.
     * 
     */
    public Optional> network() {
        return Optional.ofNullable(this.network);
    }

    /**
     * Do not import cache manifests when building the image.
     * 
     * Equivalent to Docker's `--no-cache` flag.
     * 
     */
    @Import(name="noCache")
    private @Nullable Output noCache;

    /**
     * @return Do not import cache manifests when building the image.
     * 
     * Equivalent to Docker's `--no-cache` flag.
     * 
     */
    public Optional> noCache() {
        return Optional.ofNullable(this.noCache);
    }

    /**
     * Set target platform(s) for the build. Defaults to the host's platform.
     * 
     * Equivalent to Docker's `--platform` flag.
     * 
     */
    @Import(name="platforms")
    private @Nullable Output> platforms;

    /**
     * @return Set target platform(s) for the build. Defaults to the host's platform.
     * 
     * Equivalent to Docker's `--platform` flag.
     * 
     */
    public Optional>> platforms() {
        return Optional.ofNullable(this.platforms);
    }

    /**
     * Always pull referenced images.
     * 
     * Equivalent to Docker's `--pull` flag.
     * 
     */
    @Import(name="pull")
    private @Nullable Output pull;

    /**
     * @return Always pull referenced images.
     * 
     * Equivalent to Docker's `--pull` flag.
     * 
     */
    public Optional> pull() {
        return Optional.ofNullable(this.pull);
    }

    /**
     * When `true` the build will automatically include a `registry` export.
     * 
     * Defaults to `false`.
     * 
     * Equivalent to Docker's `--push` flag.
     * 
     */
    @Import(name="push", required=true)
    private Output push;

    /**
     * @return When `true` the build will automatically include a `registry` export.
     * 
     * Defaults to `false`.
     * 
     * Equivalent to Docker's `--push` flag.
     * 
     */
    public Output push() {
        return this.push;
    }

    /**
     * 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`.
     * 
     */
    @Import(name="registries")
    private @Nullable Output> registries;

    /**
     * @return 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 Optional>> registries() {
        return Optional.ofNullable(this.registries);
    }

    /**
     * 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.
     * 
     */
    @Import(name="secrets")
    private @Nullable Output> secrets;

    /**
     * @return 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 Optional>> secrets() {
        return Optional.ofNullable(this.secrets);
    }

    /**
     * SSH agent socket or keys to expose to the build.
     * 
     * Equivalent to Docker's `--ssh` flag.
     * 
     */
    @Import(name="ssh")
    private @Nullable Output> ssh;

    /**
     * @return SSH agent socket or keys to expose to the build.
     * 
     * Equivalent to Docker's `--ssh` flag.
     * 
     */
    public Optional>> ssh() {
        return Optional.ofNullable(this.ssh);
    }

    /**
     * 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.
     * 
     */
    @Import(name="tags")
    private @Nullable Output> tags;

    /**
     * @return 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 Optional>> tags() {
        return Optional.ofNullable(this.tags);
    }

    /**
     * Set the target build stage(s) to build.
     * 
     * If not specified all targets will be built by default.
     * 
     * Equivalent to Docker's `--target` flag.
     * 
     */
    @Import(name="target")
    private @Nullable Output target;

    /**
     * @return Set the target build stage(s) to build.
     * 
     * If not specified all targets will be built by default.
     * 
     * Equivalent to Docker's `--target` flag.
     * 
     */
    public Optional> target() {
        return Optional.ofNullable(this.target);
    }

    private ImageArgs() {}

    private ImageArgs(ImageArgs $) {
        this.addHosts = $.addHosts;
        this.buildArgs = $.buildArgs;
        this.buildOnPreview = $.buildOnPreview;
        this.builder = $.builder;
        this.cacheFrom = $.cacheFrom;
        this.cacheTo = $.cacheTo;
        this.context = $.context;
        this.dockerfile = $.dockerfile;
        this.exec = $.exec;
        this.exports = $.exports;
        this.labels = $.labels;
        this.load = $.load;
        this.network = $.network;
        this.noCache = $.noCache;
        this.platforms = $.platforms;
        this.pull = $.pull;
        this.push = $.push;
        this.registries = $.registries;
        this.secrets = $.secrets;
        this.ssh = $.ssh;
        this.tags = $.tags;
        this.target = $.target;
    }

    public static Builder builder() {
        return new Builder();
    }
    public static Builder builder(ImageArgs defaults) {
        return new Builder(defaults);
    }

    public static final class Builder {
        private ImageArgs $;

        public Builder() {
            $ = new ImageArgs();
        }

        public Builder(ImageArgs defaults) {
            $ = new ImageArgs(Objects.requireNonNull(defaults));
        }

        /**
         * @param addHosts Custom `host:ip` mappings to use during the build.
         * 
         * Equivalent to Docker's `--add-host` flag.
         * 
         * @return builder
         * 
         */
        public Builder addHosts(@Nullable Output> addHosts) {
            $.addHosts = addHosts;
            return this;
        }

        /**
         * @param addHosts Custom `host:ip` mappings to use during the build.
         * 
         * Equivalent to Docker's `--add-host` flag.
         * 
         * @return builder
         * 
         */
        public Builder addHosts(List addHosts) {
            return addHosts(Output.of(addHosts));
        }

        /**
         * @param addHosts Custom `host:ip` mappings to use during the build.
         * 
         * Equivalent to Docker's `--add-host` flag.
         * 
         * @return builder
         * 
         */
        public Builder addHosts(String... addHosts) {
            return addHosts(List.of(addHosts));
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder buildArgs(@Nullable Output> buildArgs) {
            $.buildArgs = buildArgs;
            return this;
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder buildArgs(Map buildArgs) {
            return buildArgs(Output.of(buildArgs));
        }

        /**
         * @param buildOnPreview 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.
         * 
         * @return builder
         * 
         */
        public Builder buildOnPreview(@Nullable Output buildOnPreview) {
            $.buildOnPreview = buildOnPreview;
            return this;
        }

        /**
         * @param buildOnPreview 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.
         * 
         * @return builder
         * 
         */
        public Builder buildOnPreview(Boolean buildOnPreview) {
            return buildOnPreview(Output.of(buildOnPreview));
        }

        /**
         * @param builder Builder configuration.
         * 
         * @return builder
         * 
         */
        public Builder builder_(@Nullable Output builder) {
            $.builder = builder;
            return this;
        }

        /**
         * @param builder Builder configuration.
         * 
         * @return builder
         * 
         */
        public Builder builder_(BuilderConfigArgs builder) {
            return builder_(Output.of(builder));
        }

        /**
         * @param cacheFrom Cache export configuration.
         * 
         * Equivalent to Docker's `--cache-from` flag.
         * 
         * @return builder
         * 
         */
        public Builder cacheFrom(@Nullable Output> cacheFrom) {
            $.cacheFrom = cacheFrom;
            return this;
        }

        /**
         * @param cacheFrom Cache export configuration.
         * 
         * Equivalent to Docker's `--cache-from` flag.
         * 
         * @return builder
         * 
         */
        public Builder cacheFrom(List cacheFrom) {
            return cacheFrom(Output.of(cacheFrom));
        }

        /**
         * @param cacheFrom Cache export configuration.
         * 
         * Equivalent to Docker's `--cache-from` flag.
         * 
         * @return builder
         * 
         */
        public Builder cacheFrom(CacheFromArgs... cacheFrom) {
            return cacheFrom(List.of(cacheFrom));
        }

        /**
         * @param cacheTo Cache import configuration.
         * 
         * Equivalent to Docker's `--cache-to` flag.
         * 
         * @return builder
         * 
         */
        public Builder cacheTo(@Nullable Output> cacheTo) {
            $.cacheTo = cacheTo;
            return this;
        }

        /**
         * @param cacheTo Cache import configuration.
         * 
         * Equivalent to Docker's `--cache-to` flag.
         * 
         * @return builder
         * 
         */
        public Builder cacheTo(List cacheTo) {
            return cacheTo(Output.of(cacheTo));
        }

        /**
         * @param cacheTo Cache import configuration.
         * 
         * Equivalent to Docker's `--cache-to` flag.
         * 
         * @return builder
         * 
         */
        public Builder cacheTo(CacheToArgs... cacheTo) {
            return cacheTo(List.of(cacheTo));
        }

        /**
         * @param context Build context settings. Defaults to the current directory.
         * 
         * Equivalent to Docker's `PATH | URL | -` positional argument.
         * 
         * @return builder
         * 
         */
        public Builder context(@Nullable Output context) {
            $.context = context;
            return this;
        }

        /**
         * @param context Build context settings. Defaults to the current directory.
         * 
         * Equivalent to Docker's `PATH | URL | -` positional argument.
         * 
         * @return builder
         * 
         */
        public Builder context(BuildContextArgs context) {
            return context(Output.of(context));
        }

        /**
         * @param dockerfile Dockerfile settings.
         * 
         * Equivalent to Docker's `--file` flag.
         * 
         * @return builder
         * 
         */
        public Builder dockerfile(@Nullable Output dockerfile) {
            $.dockerfile = dockerfile;
            return this;
        }

        /**
         * @param dockerfile Dockerfile settings.
         * 
         * Equivalent to Docker's `--file` flag.
         * 
         * @return builder
         * 
         */
        public Builder dockerfile(DockerfileArgs dockerfile) {
            return dockerfile(Output.of(dockerfile));
        }

        /**
         * @param exec 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.
         * 
         * @return builder
         * 
         */
        public Builder exec(@Nullable Output exec) {
            $.exec = exec;
            return this;
        }

        /**
         * @param exec 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.
         * 
         * @return builder
         * 
         */
        public Builder exec(Boolean exec) {
            return exec(Output.of(exec));
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder exports(@Nullable Output> exports) {
            $.exports = exports;
            return this;
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder exports(List exports) {
            return exports(Output.of(exports));
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder exports(ExportArgs... exports) {
            return exports(List.of(exports));
        }

        /**
         * @param labels Attach arbitrary key/value metadata to the image.
         * 
         * Equivalent to Docker's `--label` flag.
         * 
         * @return builder
         * 
         */
        public Builder labels(@Nullable Output> labels) {
            $.labels = labels;
            return this;
        }

        /**
         * @param labels Attach arbitrary key/value metadata to the image.
         * 
         * Equivalent to Docker's `--label` flag.
         * 
         * @return builder
         * 
         */
        public Builder labels(Map labels) {
            return labels(Output.of(labels));
        }

        /**
         * @param load When `true` the build will automatically include a `docker` export.
         * 
         * Defaults to `false`.
         * 
         * Equivalent to Docker's `--load` flag.
         * 
         * @return builder
         * 
         */
        public Builder load(@Nullable Output load) {
            $.load = load;
            return this;
        }

        /**
         * @param load When `true` the build will automatically include a `docker` export.
         * 
         * Defaults to `false`.
         * 
         * Equivalent to Docker's `--load` flag.
         * 
         * @return builder
         * 
         */
        public Builder load(Boolean load) {
            return load(Output.of(load));
        }

        /**
         * @param network 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.
         * 
         * @return builder
         * 
         */
        public Builder network(@Nullable Output network) {
            $.network = network;
            return this;
        }

        /**
         * @param network 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.
         * 
         * @return builder
         * 
         */
        public Builder network(NetworkMode network) {
            return network(Output.of(network));
        }

        /**
         * @param noCache Do not import cache manifests when building the image.
         * 
         * Equivalent to Docker's `--no-cache` flag.
         * 
         * @return builder
         * 
         */
        public Builder noCache(@Nullable Output noCache) {
            $.noCache = noCache;
            return this;
        }

        /**
         * @param noCache Do not import cache manifests when building the image.
         * 
         * Equivalent to Docker's `--no-cache` flag.
         * 
         * @return builder
         * 
         */
        public Builder noCache(Boolean noCache) {
            return noCache(Output.of(noCache));
        }

        /**
         * @param platforms Set target platform(s) for the build. Defaults to the host's platform.
         * 
         * Equivalent to Docker's `--platform` flag.
         * 
         * @return builder
         * 
         */
        public Builder platforms(@Nullable Output> platforms) {
            $.platforms = platforms;
            return this;
        }

        /**
         * @param platforms Set target platform(s) for the build. Defaults to the host's platform.
         * 
         * Equivalent to Docker's `--platform` flag.
         * 
         * @return builder
         * 
         */
        public Builder platforms(List platforms) {
            return platforms(Output.of(platforms));
        }

        /**
         * @param platforms Set target platform(s) for the build. Defaults to the host's platform.
         * 
         * Equivalent to Docker's `--platform` flag.
         * 
         * @return builder
         * 
         */
        public Builder platforms(Platform... platforms) {
            return platforms(List.of(platforms));
        }

        /**
         * @param pull Always pull referenced images.
         * 
         * Equivalent to Docker's `--pull` flag.
         * 
         * @return builder
         * 
         */
        public Builder pull(@Nullable Output pull) {
            $.pull = pull;
            return this;
        }

        /**
         * @param pull Always pull referenced images.
         * 
         * Equivalent to Docker's `--pull` flag.
         * 
         * @return builder
         * 
         */
        public Builder pull(Boolean pull) {
            return pull(Output.of(pull));
        }

        /**
         * @param push When `true` the build will automatically include a `registry` export.
         * 
         * Defaults to `false`.
         * 
         * Equivalent to Docker's `--push` flag.
         * 
         * @return builder
         * 
         */
        public Builder push(Output push) {
            $.push = push;
            return this;
        }

        /**
         * @param push When `true` the build will automatically include a `registry` export.
         * 
         * Defaults to `false`.
         * 
         * Equivalent to Docker's `--push` flag.
         * 
         * @return builder
         * 
         */
        public Builder push(Boolean push) {
            return push(Output.of(push));
        }

        /**
         * @param 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`.
         * 
         * @return builder
         * 
         */
        public Builder registries(@Nullable Output> registries) {
            $.registries = registries;
            return this;
        }

        /**
         * @param 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`.
         * 
         * @return builder
         * 
         */
        public Builder registries(List registries) {
            return registries(Output.of(registries));
        }

        /**
         * @param 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`.
         * 
         * @return builder
         * 
         */
        public Builder registries(RegistryArgs... registries) {
            return registries(List.of(registries));
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder secrets(@Nullable Output> secrets) {
            $.secrets = secrets;
            return this;
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder secrets(Map secrets) {
            return secrets(Output.of(secrets));
        }

        /**
         * @param ssh SSH agent socket or keys to expose to the build.
         * 
         * Equivalent to Docker's `--ssh` flag.
         * 
         * @return builder
         * 
         */
        public Builder ssh(@Nullable Output> ssh) {
            $.ssh = ssh;
            return this;
        }

        /**
         * @param ssh SSH agent socket or keys to expose to the build.
         * 
         * Equivalent to Docker's `--ssh` flag.
         * 
         * @return builder
         * 
         */
        public Builder ssh(List ssh) {
            return ssh(Output.of(ssh));
        }

        /**
         * @param ssh SSH agent socket or keys to expose to the build.
         * 
         * Equivalent to Docker's `--ssh` flag.
         * 
         * @return builder
         * 
         */
        public Builder ssh(SSHArgs... ssh) {
            return ssh(List.of(ssh));
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder tags(@Nullable Output> tags) {
            $.tags = tags;
            return this;
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder tags(List tags) {
            return tags(Output.of(tags));
        }

        /**
         * @param 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.
         * 
         * @return builder
         * 
         */
        public Builder tags(String... tags) {
            return tags(List.of(tags));
        }

        /**
         * @param target Set the target build stage(s) to build.
         * 
         * If not specified all targets will be built by default.
         * 
         * Equivalent to Docker's `--target` flag.
         * 
         * @return builder
         * 
         */
        public Builder target(@Nullable Output target) {
            $.target = target;
            return this;
        }

        /**
         * @param target Set the target build stage(s) to build.
         * 
         * If not specified all targets will be built by default.
         * 
         * Equivalent to Docker's `--target` flag.
         * 
         * @return builder
         * 
         */
        public Builder target(String target) {
            return target(Output.of(target));
        }

        public ImageArgs build() {
            $.buildOnPreview = Codegen.booleanProp("buildOnPreview").output().arg($.buildOnPreview).def(true).getNullable();
            $.network = Codegen.objectProp("network", NetworkMode.class).output().arg($.network).def(NetworkMode.Default_).getNullable();
            if ($.push == null) {
                throw new MissingRequiredPropertyException("ImageArgs", "push");
            }
            return $;
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy