1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
//! <!-- Bug: Type and Name are switched -->
//! Pulls a Docker image to a given Docker host from a Docker Registry.
//! This resource will *not* pull new layers of the image automatically unless used in conjunction with docker.RegistryImage data source to update the `pull_triggers` field.
//!
//! ## Example Usage
//!
//! ### Basic
//!
//! Finds and downloads the latest `ubuntu:precise` image but does not check
//! for further updates of the image
//!
//! <!--Start PulumiCodeChooser -->
//! ### Typescript
//! ```typescript
//! import * as pulumi from "@pulumi/pulumi";
//! import * as docker from "@pulumi/docker";
//!
//! const ubuntu = new docker.RemoteImage("ubuntu", {name: "ubuntu:precise"});
//! ```
//! ### Python
//! ```python
//! import pulumi
//! import pulumi_docker as docker
//!
//! ubuntu = docker.RemoteImage("ubuntu", name="ubuntu:precise")
//! ```
//! ### C#
//! ```csharp
//! using System.Collections.Generic;
//! using System.Linq;
//! using Pulumi;
//! using Docker = Pulumi.Docker;
//!
//! return await Deployment.RunAsync(() =>
//! {
//! var ubuntu = new Docker.RemoteImage("ubuntu", new()
//! {
//! Name = "ubuntu:precise",
//! });
//!
//! });
//! ```
//! ### Go
//! ```go
//! package main
//!
//! import (
//! "github.com/pulumi/pulumi-docker/sdk/v4/go/docker"
//! "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//! )
//!
//! func main() {
//! pulumi.Run(func(ctx *pulumi.Context) error {
//! _, err := docker.NewRemoteImage(ctx, "ubuntu", &docker.RemoteImageArgs{
//! Name: pulumi.String("ubuntu:precise"),
//! })
//! if err != nil {
//! return err
//! }
//! return nil
//! })
//! }
//! ```
//! ### Java
//! ```java
//! package generated_program;
//!
//! import com.pulumi.Context;
//! import com.pulumi.Pulumi;
//! import com.pulumi.core.Output;
//! import com.pulumi.docker.RemoteImage;
//! import com.pulumi.docker.RemoteImageArgs;
//! import java.util.List;
//! import java.util.ArrayList;
//! import java.util.Map;
//! import java.io.File;
//! import java.nio.file.Files;
//! import java.nio.file.Paths;
//!
//! public class App {
//! public static void main(String[] args) {
//! Pulumi.run(App::stack);
//! }
//!
//! public static void stack(Context ctx) {
//! var ubuntu = new RemoteImage("ubuntu", RemoteImageArgs.builder()
//! .name("ubuntu:precise")
//! .build());
//!
//! }
//! }
//! ```
//! ### YAML
//! ```yaml
//! resources:
//! ubuntu:
//! type: docker:RemoteImage
//! properties:
//! name: ubuntu:precise
//! ```
//! <!--End PulumiCodeChooser -->
//!
//! ### Dynamic updates
//!
//! To be able to update an image dynamically when the `sha256` sum changes,
//! you need to use it in combination with `docker.RegistryImage` as follows:
//!
//! <!--Start PulumiCodeChooser -->
//! ### Typescript
//! ```typescript
//! import * as pulumi from "@pulumi/pulumi";
//! import * as docker from "@pulumi/docker";
//!
//! const ubuntuRegistryImage = docker.getRegistryImage({
//! name: "ubuntu:precise",
//! });
//! const ubuntuRemoteImage = new docker.RemoteImage("ubuntuRemoteImage", {
//! name: ubuntuRegistryImage.then(ubuntuRegistryImage => ubuntuRegistryImage.name),
//! pullTriggers: [ubuntuRegistryImage.then(ubuntuRegistryImage => ubuntuRegistryImage.sha256Digest)],
//! });
//! ```
//! ### Python
//! ```python
//! import pulumi
//! import pulumi_docker as docker
//!
//! ubuntu_registry_image = docker.get_registry_image(name="ubuntu:precise")
//! ubuntu_remote_image = docker.RemoteImage("ubuntuRemoteImage",
//! name=ubuntu_registry_image.name,
//! pull_triggers=[ubuntu_registry_image.sha256_digest])
//! ```
//! ### C#
//! ```csharp
//! using System.Collections.Generic;
//! using System.Linq;
//! using Pulumi;
//! using Docker = Pulumi.Docker;
//!
//! return await Deployment.RunAsync(() =>
//! {
//! var ubuntuRegistryImage = Docker.GetRegistryImage.Invoke(new()
//! {
//! Name = "ubuntu:precise",
//! });
//!
//! var ubuntuRemoteImage = new Docker.RemoteImage("ubuntuRemoteImage", new()
//! {
//! Name = ubuntuRegistryImage.Apply(getRegistryImageResult => getRegistryImageResult.Name),
//! PullTriggers = new[]
//! {
//! ubuntuRegistryImage.Apply(getRegistryImageResult => getRegistryImageResult.Sha256Digest),
//! },
//! });
//!
//! });
//! ```
//! ### Go
//! ```go
//! package main
//!
//! import (
//! "github.com/pulumi/pulumi-docker/sdk/v4/go/docker"
//! "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//! )
//!
//! func main() {
//! pulumi.Run(func(ctx *pulumi.Context) error {
//! ubuntuRegistryImage, err := docker.LookupRegistryImage(ctx, &docker.LookupRegistryImageArgs{
//! Name: "ubuntu:precise",
//! }, nil)
//! if err != nil {
//! return err
//! }
//! _, err = docker.NewRemoteImage(ctx, "ubuntuRemoteImage", &docker.RemoteImageArgs{
//! Name: pulumi.String(ubuntuRegistryImage.Name),
//! PullTriggers: pulumi.StringArray{
//! pulumi.String(ubuntuRegistryImage.Sha256Digest),
//! },
//! })
//! if err != nil {
//! return err
//! }
//! return nil
//! })
//! }
//! ```
//! ### Java
//! ```java
//! package generated_program;
//!
//! import com.pulumi.Context;
//! import com.pulumi.Pulumi;
//! import com.pulumi.core.Output;
//! import com.pulumi.docker.DockerFunctions;
//! import com.pulumi.docker.inputs.GetRegistryImageArgs;
//! import com.pulumi.docker.RemoteImage;
//! import com.pulumi.docker.RemoteImageArgs;
//! import java.util.List;
//! import java.util.ArrayList;
//! import java.util.Map;
//! import java.io.File;
//! import java.nio.file.Files;
//! import java.nio.file.Paths;
//!
//! public class App {
//! public static void main(String[] args) {
//! Pulumi.run(App::stack);
//! }
//!
//! public static void stack(Context ctx) {
//! final var ubuntuRegistryImage = DockerFunctions.getRegistryImage(GetRegistryImageArgs.builder()
//! .name("ubuntu:precise")
//! .build());
//!
//! var ubuntuRemoteImage = new RemoteImage("ubuntuRemoteImage", RemoteImageArgs.builder()
//! .name(ubuntuRegistryImage.applyValue(getRegistryImageResult -> getRegistryImageResult.name()))
//! .pullTriggers(ubuntuRegistryImage.applyValue(getRegistryImageResult -> getRegistryImageResult.sha256Digest()))
//! .build());
//!
//! }
//! }
//! ```
//! ### YAML
//! ```yaml
//! resources:
//! ubuntuRemoteImage:
//! type: docker:RemoteImage
//! properties:
//! name: ${ubuntuRegistryImage.name}
//! pullTriggers:
//! - ${ubuntuRegistryImage.sha256Digest}
//! variables:
//! ubuntuRegistryImage:
//! fn::invoke:
//! Function: docker:getRegistryImage
//! Arguments:
//! name: ubuntu:precise
//! ```
//! <!--End PulumiCodeChooser -->
//!
//! ### Build
//!
//! You can also use the resource to build an image.
//! In this case the image "zoo" and "zoo:develop" are built.
//!
//! <!--Start PulumiCodeChooser -->
//! ### Typescript
//! ```typescript
//! import * as pulumi from "@pulumi/pulumi";
//! import * as docker from "@pulumi/docker";
//!
//! const zoo = new docker.RemoteImage("zoo", {
//! name: "zoo",
//! build: {
//! context: ".",
//! tags: ["zoo:develop"],
//! buildArg: {
//! foo: "zoo",
//! },
//! label: {
//! author: "zoo",
//! },
//! },
//! });
//! ```
//! ### Python
//! ```python
//! import pulumi
//! import pulumi_docker as docker
//!
//! zoo = docker.RemoteImage("zoo",
//! name="zoo",
//! build=docker.RemoteImageBuildArgs(
//! context=".",
//! tags=["zoo:develop"],
//! build_arg={
//! "foo": "zoo",
//! },
//! label={
//! "author": "zoo",
//! },
//! ))
//! ```
//! ### C#
//! ```csharp
//! using System.Collections.Generic;
//! using System.Linq;
//! using Pulumi;
//! using Docker = Pulumi.Docker;
//!
//! return await Deployment.RunAsync(() =>
//! {
//! var zoo = new Docker.RemoteImage("zoo", new()
//! {
//! Name = "zoo",
//! Build = new Docker.Inputs.RemoteImageBuildArgs
//! {
//! Context = ".",
//! Tags = new[]
//! {
//! "zoo:develop",
//! },
//! BuildArg =
//! {
//! { "foo", "zoo" },
//! },
//! Label =
//! {
//! { "author", "zoo" },
//! },
//! },
//! });
//!
//! });
//! ```
//! ### Go
//! ```go
//! package main
//!
//! import (
//! "github.com/pulumi/pulumi-docker/sdk/v4/go/docker"
//! "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//! )
//!
//! func main() {
//! pulumi.Run(func(ctx *pulumi.Context) error {
//! _, err := docker.NewRemoteImage(ctx, "zoo", &docker.RemoteImageArgs{
//! Name: pulumi.String("zoo"),
//! Build: &docker.RemoteImageBuildArgs{
//! Context: pulumi.String("."),
//! Tags: pulumi.StringArray{
//! pulumi.String("zoo:develop"),
//! },
//! BuildArg: pulumi.StringMap{
//! "foo": pulumi.String("zoo"),
//! },
//! Label: pulumi.StringMap{
//! "author": pulumi.String("zoo"),
//! },
//! },
//! })
//! if err != nil {
//! return err
//! }
//! return nil
//! })
//! }
//! ```
//! ### Java
//! ```java
//! package generated_program;
//!
//! import com.pulumi.Context;
//! import com.pulumi.Pulumi;
//! import com.pulumi.core.Output;
//! import com.pulumi.docker.RemoteImage;
//! import com.pulumi.docker.RemoteImageArgs;
//! import com.pulumi.docker.inputs.RemoteImageBuildArgs;
//! import java.util.List;
//! import java.util.ArrayList;
//! import java.util.Map;
//! import java.io.File;
//! import java.nio.file.Files;
//! import java.nio.file.Paths;
//!
//! public class App {
//! public static void main(String[] args) {
//! Pulumi.run(App::stack);
//! }
//!
//! public static void stack(Context ctx) {
//! var zoo = new RemoteImage("zoo", RemoteImageArgs.builder()
//! .name("zoo")
//! .build(RemoteImageBuildArgs.builder()
//! .context(".")
//! .tags("zoo:develop")
//! .buildArg(Map.of("foo", "zoo"))
//! .label(Map.of("author", "zoo"))
//! .build())
//! .build());
//!
//! }
//! }
//! ```
//! ### YAML
//! ```yaml
//! resources:
//! zoo:
//! type: docker:RemoteImage
//! properties:
//! name: zoo
//! build:
//! context: .
//! tags:
//! - zoo:develop
//! buildArg:
//! foo: zoo
//! label:
//! author: zoo
//! ```
//! <!--End PulumiCodeChooser -->
//!
//! You can use the `triggers` argument to specify when the image should be rebuild. This is for example helpful when you want to rebuild the docker image whenever the source code changes.
//!
#[derive(bon::Builder)]
#[builder(finish_fn = build_struct)]
pub struct RemoteImageArgs {
/// Configuration to build an image. Please see [docker build command reference](https://docs.docker.com/engine/reference/commandline/build/#options) too.
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub build: pulumi_wasm_rust::Output<Option<crate::types::RemoteImageBuild>>,
/// Always remove intermediate containers
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub force_remove: pulumi_wasm_rust::Output<Option<bool>>,
/// If true, then the Docker image won't be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub keep_locally: pulumi_wasm_rust::Output<Option<bool>>,
/// type of ulimit, e.g. `nofile`
#[builder(into)]
pub name: pulumi_wasm_rust::Output<String>,
/// Set platform if server is multi-platform capable
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub platform: pulumi_wasm_rust::Output<Option<String>>,
/// List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker*registry*image.
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub pull_triggers: pulumi_wasm_rust::Output<Option<Vec<String>>>,
/// A map of arbitrary strings that, when changed, will force the `docker.RemoteImage` resource to be replaced. This can be used to rebuild an image when contents of source code folders change
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub triggers: pulumi_wasm_rust::Output<Option<std::collections::HashMap<String, String>>>,
}
pub struct RemoteImageResult {
/// Configuration to build an image. Please see [docker build command reference](https://docs.docker.com/engine/reference/commandline/build/#options) too.
pub build: pulumi_wasm_rust::Output<Option<crate::types::RemoteImageBuild>>,
/// Always remove intermediate containers
pub force_remove: pulumi_wasm_rust::Output<Option<bool>>,
/// The ID of the image (as seen when executing `docker inspect` on the image). Can be used to reference the image via its ID in other resources.
pub image_id: pulumi_wasm_rust::Output<String>,
/// If true, then the Docker image won't be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.
pub keep_locally: pulumi_wasm_rust::Output<Option<bool>>,
/// type of ulimit, e.g. `nofile`
pub name: pulumi_wasm_rust::Output<String>,
/// Set platform if server is multi-platform capable
pub platform: pulumi_wasm_rust::Output<Option<String>>,
/// List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker*registry*image.
pub pull_triggers: pulumi_wasm_rust::Output<Option<Vec<String>>>,
/// The image sha256 digest in the form of `repo[:tag]@sha256:<hash>`.
pub repo_digest: pulumi_wasm_rust::Output<String>,
/// A map of arbitrary strings that, when changed, will force the `docker.RemoteImage` resource to be replaced. This can be used to rebuild an image when contents of source code folders change
pub triggers: pulumi_wasm_rust::Output<Option<std::collections::HashMap<String, String>>>,
}
///
/// Registers a new resource with the given unique name and arguments
///
pub fn create(name: &str, args: RemoteImageArgs) -> RemoteImageResult {
let result = crate::bindings::pulumi::docker::remote_image::invoke(name, &crate::bindings::pulumi::docker::remote_image::Args {
build: &args.build.get_inner(),
force_remove: &args.force_remove.get_inner(),
keep_locally: &args.keep_locally.get_inner(),
name: &args.name.get_inner(),
platform: &args.platform.get_inner(),
pull_triggers: &args.pull_triggers.get_inner(),
triggers: &args.triggers.get_inner(),
});
RemoteImageResult {
build: crate::into_domain(result.build),
force_remove: crate::into_domain(result.force_remove),
image_id: crate::into_domain(result.image_id),
keep_locally: crate::into_domain(result.keep_locally),
name: crate::into_domain(result.name),
platform: crate::into_domain(result.platform),
pull_triggers: crate::into_domain(result.pull_triggers),
repo_digest: crate::into_domain(result.repo_digest),
triggers: crate::into_domain(result.triggers),
}
}