UNPKG

@pulumi/docker-build

Version:

[![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM version](https://badge.fury.io/js/%40pulumi%2fdocker-build.svg)](https://www.npmjs.com/package/@pulumi/docker-build) [![Python version](https://badge.fury.io/p

164 lines 6.26 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Index = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * A wrapper around `docker buildx imagetools create` to create an index * (or manifest list) referencing one or more existing images. * * In most cases you do not need an `Index` to build a multi-platform * image -- specifying multiple platforms on the `Image` will handle this * for you automatically. * * However, as of April 2024, building multi-platform images _with * caching_ will only export a cache for one platform at a time (see [this * discussion](https://github.com/docker/buildx/discussions/1382) for more * details). * * Therefore this resource can be helpful if you are building * multi-platform images with caching: each platform can be built and * cached separately, and an `Index` can join them all together. An * example of this is shown below. * * This resource creates an OCI image index or a Docker manifest list * depending on the media types of the source images. * * ## Example Usage * ### Multi-platform registry caching * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as docker_build from "@pulumi/docker-build"; * * const amd64 = new docker_build.Image("amd64", { * cacheFrom: [{ * registry: { * ref: "docker.io/pulumi/pulumi:cache-amd64", * }, * }], * cacheTo: [{ * registry: { * mode: docker_build.CacheMode.Max, * ref: "docker.io/pulumi/pulumi:cache-amd64", * }, * }], * context: { * location: "app", * }, * platforms: [docker_build.Platform.Linux_amd64], * tags: ["docker.io/pulumi/pulumi:3.107.0-amd64"], * }); * const arm64 = new docker_build.Image("arm64", { * cacheFrom: [{ * registry: { * ref: "docker.io/pulumi/pulumi:cache-arm64", * }, * }], * cacheTo: [{ * registry: { * mode: docker_build.CacheMode.Max, * ref: "docker.io/pulumi/pulumi:cache-arm64", * }, * }], * context: { * location: "app", * }, * platforms: [docker_build.Platform.Linux_arm64], * tags: ["docker.io/pulumi/pulumi:3.107.0-arm64"], * }); * const index = new docker_build.Index("index", { * sources: [ * amd64.ref, * arm64.ref, * ], * tag: "docker.io/pulumi/pulumi:3.107.0", * }); * export const ref = index.ref; * ``` */ class Index extends pulumi.CustomResource { /** * Get an existing Index resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, opts) { return new Index(name, undefined, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'docker-build:index:Index'; /** * Returns true if the given object is an instance of Index. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Index.__pulumiType; } /** * Create a Index resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name, args, opts) { let resourceInputs = {}; opts = opts || {}; if (!opts.id) { if (args?.sources === undefined && !opts.urn) { throw new Error("Missing required property 'sources'"); } if (args?.tag === undefined && !opts.urn) { throw new Error("Missing required property 'tag'"); } resourceInputs["push"] = (args?.push) ?? true; resourceInputs["registry"] = args?.registry; resourceInputs["sources"] = args?.sources; resourceInputs["tag"] = args?.tag; resourceInputs["ref"] = undefined /*out*/; } else { resourceInputs["push"] = undefined /*out*/; resourceInputs["ref"] = undefined /*out*/; resourceInputs["registry"] = undefined /*out*/; resourceInputs["sources"] = undefined /*out*/; resourceInputs["tag"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Index.__pulumiType, name, resourceInputs, opts); } } exports.Index = Index; //# sourceMappingURL=index_.js.map