diff --git a/container-azure-csharp/${PROJECT}.csproj b/container-azure-csharp/${PROJECT}.csproj index cf1337143..ff34d7be4 100644 --- a/container-azure-csharp/${PROJECT}.csproj +++ b/container-azure-csharp/${PROJECT}.csproj @@ -11,7 +11,7 @@ - + diff --git a/container-azure-csharp/Program.cs b/container-azure-csharp/Program.cs index 2399b518d..14fdaec8b 100644 --- a/container-azure-csharp/Program.cs +++ b/container-azure-csharp/Program.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Pulumi; using AzureNative = Pulumi.AzureNative; -using Docker = Pulumi.Docker; +using DockerBuild = Pulumi.DockerBuild; using Random = Pulumi.Random; return await Pulumi.Deployment.RunAsync(() => @@ -39,17 +39,29 @@ var registryPassword = credentials.Apply(result => result.Passwords[0]!.Value!); // Create a container image for the service. - var image = new Docker.Image("image", new() + var image = new DockerBuild.Image("image", new() { - ImageName = Pulumi.Output.Format($"{registry.LoginServer}/{imageName}:{imageTag}"), - Build = new Docker.Inputs.DockerBuildArgs { - Context = appPath, - Platform = "linux/amd64", + Tags = new[] + { + Pulumi.Output.Format($"{registry.LoginServer}/{imageName}:{imageTag}"), }, - Registry = new Docker.Inputs.RegistryArgs { - Server = registry.LoginServer, - Username = registryUsername, - Password = registryPassword, + Context = new DockerBuild.Inputs.BuildContextArgs + { + Location = appPath, + }, + Platforms = new[] + { + DockerBuild.Platform.Linux_amd64, + + }, + Registries = new[] + { + new DockerBuild.Inputs.RegistryArgs + { + Address = registry.LoginServer, + Password = registryPassword, + Username = registryUsername, + }, }, }); @@ -75,7 +87,7 @@ { new AzureNative.ContainerInstance.Inputs.ContainerArgs { Name = imageName, - Image = image.ImageName, + Image = image.Ref, Ports = new[] { new AzureNative.ContainerInstance.Inputs.ContainerPortArgs { diff --git a/container-azure-go/go.mod b/container-azure-go/go.mod index 246f2ee97..04332c1a6 100644 --- a/container-azure-go/go.mod +++ b/container-azure-go/go.mod @@ -1,12 +1,14 @@ module ${PROJECT} -go 1.20 +go 1.21.7 + +toolchain go1.22.1 require ( github.com/pulumi/pulumi-azure-native-sdk/containerinstance/v2 v2.1.1 github.com/pulumi/pulumi-azure-native-sdk/containerregistry/v2 v2.1.1 github.com/pulumi/pulumi-azure-native-sdk/resources/v2 v2.0.0 + github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild v0.0.6 github.com/pulumi/pulumi-random/sdk/v4 v4.8.2 - github.com/pulumi/pulumi-docker/sdk/v4 v4.2.3 - github.com/pulumi/pulumi/sdk/v3 v3.96.1 + github.com/pulumi/pulumi/sdk/v3 v3.128.0 ) diff --git a/container-azure-go/main.go b/container-azure-go/main.go index a539a42d4..60def3a1b 100644 --- a/container-azure-go/main.go +++ b/container-azure-go/main.go @@ -7,7 +7,7 @@ import ( "github.com/pulumi/pulumi-azure-native-sdk/containerinstance/v2" "github.com/pulumi/pulumi-azure-native-sdk/containerregistry/v2" "github.com/pulumi/pulumi-azure-native-sdk/resources/v2" - "github.com/pulumi/pulumi-docker/sdk/v4/go/docker" + "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild" "github.com/pulumi/pulumi-random/sdk/v4/go/random" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config" @@ -70,16 +70,18 @@ func main() { registryPassword := credentials.Passwords().Index(pulumi.Int(0)).Value().Elem() // Create a container image for the service. - image, err := docker.NewImage(ctx, "image", &docker.ImageArgs{ - ImageName: pulumi.Sprintf("%s/%s:%s", registry.LoginServer, imageName, imageTag), - Build: docker.DockerBuildArgs{ - Context: pulumi.String(appPath), - Platform: pulumi.String("linux/amd64"), + image, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{ + Tags: pulumi.StringArray{pulumi.Sprintf("%s/%s:%s", registry.LoginServer, imageName, imageTag)}, + Context: &dockerbuild.BuildContextArgs{ + Location: pulumi.String(appPath), }, - Registry: docker.RegistryArgs{ - Server: registry.LoginServer, - Username: registryUsername, - Password: registryPassword, + Platforms: dockerbuild.PlatformArray{dockerbuild.Platform_Linux_amd64}, + Registries: dockerbuild.RegistryArray{ + &dockerbuild.RegistryArgs{ + Address: registry.LoginServer, + Username: registryUsername, + Password: registryPassword, + }, }, }) if err != nil { @@ -113,7 +115,7 @@ func main() { Containers: containerinstance.ContainerArray{ containerinstance.ContainerArgs{ Name: pulumi.String(imageName), - Image: image.ImageName, + Image: image.Ref, Ports: containerinstance.ContainerPortArray{ containerinstance.ContainerPortArgs{ Port: pulumi.Int(containerPort), diff --git a/container-azure-python/__main__.py b/container-azure-python/__main__.py index 87154c38c..b1c59062f 100644 --- a/container-azure-python/__main__.py +++ b/container-azure-python/__main__.py @@ -1,5 +1,5 @@ import pulumi -import pulumi_docker as docker +import pulumi_docker_build as docker_build import pulumi_random as random from pulumi_azure_native import resources, containerregistry, containerinstance @@ -37,18 +37,18 @@ registry_password = credentials.apply(lambda creds: creds.passwords[0].value) # Create a container image for the service. -image = docker.Image( +image = docker_build.Image( "image", - image_name=pulumi.Output.concat(registry.login_server, f"/{image_name}:{image_tag}"), - build=docker.DockerBuildArgs( - context=app_path, - platform="linux/amd64", + tags=[pulumi.Output.concat(registry.login_server, f"/{image_name}:{image_tag}")], + context=docker_build.BuildContextArgs( + location=app_path, ), - registry=docker.RegistryArgs( - server=registry.login_server, + platforms=[docker_build.Platform.LINUX_AMD64], + registries=[docker_build.RegistryArgs( + address=registry.login_server, username=registry_username, password=registry_password, - ), + )], ) # Use a random string to give the service a unique DNS name. diff --git a/container-azure-python/requirements.txt b/container-azure-python/requirements.txt index 2affa6491..104707bc7 100644 --- a/container-azure-python/requirements.txt +++ b/container-azure-python/requirements.txt @@ -1,4 +1,4 @@ pulumi>=3.0.0,<4.0.0 pulumi-azure-native>=2.0.0,<3.0.0 pulumi-random>=4.0.0,<5.0.0 -pulumi-docker>=4.0.0,<5.0.0 +pulumi-docker-build>=0.0.0,<1.0.0 diff --git a/container-azure-typescript/index.ts b/container-azure-typescript/index.ts index 331df6f8a..9e1c16537 100644 --- a/container-azure-typescript/index.ts +++ b/container-azure-typescript/index.ts @@ -3,7 +3,7 @@ import * as resources from "@pulumi/azure-native/resources"; import * as containerregistry from "@pulumi/azure-native/containerregistry"; import * as containerinstance from "@pulumi/azure-native/containerinstance"; import * as random from "@pulumi/random"; -import * as docker from "@pulumi/docker"; +import * as dockerbuild from "@pulumi/docker-build"; // Import the program's configuration settings. const config = new pulumi.Config(); @@ -38,17 +38,17 @@ const credentials = containerregistry.listRegistryCredentialsOutput({ }); // Create a container image for the service. -const image = new docker.Image("image", { - imageName: pulumi.interpolate`${registry.loginServer}/${imageName}:${imageTag}`, - build: { - context: appPath, - platform: "linux/amd64", +const image = new dockerbuild.Image("image", { + tags: [pulumi.interpolate`${registry.loginServer}/${imageName}:${imageTag}`], + context: { + location: appPath, }, - registry: { - server: registry.loginServer, + platforms: ["linux/amd64"], + registries: [{ + address: registry.loginServer, username: credentials.username, password: credentials.password, - }, + }], }); // Use a random string to give the service a unique DNS name. diff --git a/container-azure-typescript/package.json b/container-azure-typescript/package.json index 910629c6b..06d38ab0e 100644 --- a/container-azure-typescript/package.json +++ b/container-azure-typescript/package.json @@ -6,7 +6,7 @@ }, "dependencies": { "@pulumi/azure-native": "^2.0.0", - "@pulumi/docker": "^4.2.3", + "@pulumi/docker-build": "^0.0.6", "@pulumi/random": "^4.8.2", "@pulumi/pulumi": "^3.113.0" } diff --git a/container-gcp-csharp/${PROJECT}.csproj b/container-gcp-csharp/${PROJECT}.csproj index ce8f83aa9..e028b4d84 100644 --- a/container-gcp-csharp/${PROJECT}.csproj +++ b/container-gcp-csharp/${PROJECT}.csproj @@ -11,7 +11,7 @@ - + diff --git a/container-gcp-csharp/Program.cs b/container-gcp-csharp/Program.cs index 177fbc66a..d3352849f 100644 --- a/container-gcp-csharp/Program.cs +++ b/container-gcp-csharp/Program.cs @@ -1,6 +1,6 @@ using Pulumi; using Gcp = Pulumi.Gcp; -using Docker = Pulumi.Docker; +using DockerBuild = Pulumi.DockerBuild; using System.Collections.Generic; using Random = Pulumi.Random; using Output = Pulumi.Output; @@ -47,14 +47,21 @@ // Create a container image for the service. // Before running `pulumi up`, configure Docker for Artifact Registry authentication // as described here: https://cloud.google.com/artifact-registry/docs/docker/authentication - var image = new Docker.Image("image", new() + var image = new DockerBuild.Image("image", new() { - ImageName = Output.Format($"{repoUrl}/{imageName}"), - Build = new Docker.Inputs.DockerBuildArgs { - Context = appPath, + Tags = new[] + { + Output.Format($"{repoUrl}/{imageName}"), + }, + Context = new DockerBuild.Inputs.BuildContextArgs + { + Location = appPath, + }, + Platforms = new[] + { // Cloud Run currently requires x86_64 images // https://cloud.google.com/run/docs/container-contract#languages - Platform = "linux/amd64", + DockerBuild.Platform.Linux_amd64, }, }); @@ -70,7 +77,7 @@ { new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs { - Image = image.RepoDigest, + Image = image.Ref, Resources = new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerResourcesArgs { Limits = { diff --git a/container-gcp-go/go.mod b/container-gcp-go/go.mod index 340888c5c..51f1915ab 100644 --- a/container-gcp-go/go.mod +++ b/container-gcp-go/go.mod @@ -1,9 +1,12 @@ module ${PROJECT} -go 1.20 +go 1.21.7 + +toolchain go1.22.1 require ( + github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild v0.0.6 github.com/pulumi/pulumi-gcp/sdk/v7 v7.0.0 github.com/pulumi/pulumi-random/sdk/v4 v4.13.2 - github.com/pulumi/pulumi/sdk/v3 v3.91.1 + github.com/pulumi/pulumi/sdk/v3 v3.128.0 ) diff --git a/container-gcp-go/main.go b/container-gcp-go/main.go index d283ec3de..26caf4c57 100644 --- a/container-gcp-go/main.go +++ b/container-gcp-go/main.go @@ -3,7 +3,7 @@ package main import ( "strconv" - "github.com/pulumi/pulumi-docker/sdk/v4/go/docker" + "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild" "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/artifactregistry" "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrun" "github.com/pulumi/pulumi-random/sdk/v4/go/random" @@ -76,15 +76,14 @@ func main() { // Create a container image for the service. // Before running `pulumi up`, configure Docker for authentication to Artifact Registry as // described here: https://cloud.google.com/artifact-registry/docs/docker/authentication - image, err := docker.NewImage(ctx, "image", &docker.ImageArgs{ - Registry: docker.RegistryArgs{}, - ImageName: pulumi.Sprintf("%s/%s", repoUrl, imageName), - Build: docker.DockerBuildArgs{ - Context: pulumi.String(appPath), - // Cloud Run currently requires x86_64 images - // https://cloud.google.com/run/docs/container-contract#languages - Platform: pulumi.String("linux/amd64"), + image, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{ + Tags: pulumi.StringArray{pulumi.Sprintf("%s/%s", repoUrl, imageName)}, + Context: &dockerbuild.BuildContextArgs{ + Location: pulumi.String(appPath), }, + // Cloud Run currently requires x86_64 images + // https://cloud.google.com/run/docs/container-contract#languages + Platforms: dockerbuild.PlatformArray{"linux/amd64"}, }) if err != nil { return err @@ -97,7 +96,7 @@ func main() { Spec: cloudrun.ServiceTemplateSpecArgs{ Containers: cloudrun.ServiceTemplateSpecContainerArray{ cloudrun.ServiceTemplateSpecContainerArgs{ - Image: image.RepoDigest.Elem(), + Image: image.Ref.Elem(), Resources: cloudrun.ServiceTemplateSpecContainerResourcesArgs{ Limits: pulumi.ToStringMap(map[string]string{ "memory": memory, diff --git a/container-gcp-python/__main__.py b/container-gcp-python/__main__.py index 57f575d1e..2cd03abf4 100644 --- a/container-gcp-python/__main__.py +++ b/container-gcp-python/__main__.py @@ -1,5 +1,5 @@ import pulumi -import pulumi_docker as docker +import pulumi_docker_build as docker_build from pulumi_gcp import cloudrun, config as gcp_config from pulumi_gcp import artifactregistry import pulumi_random as random @@ -53,15 +53,15 @@ # Create a container image for the service. # Before running `pulumi up`, configure Docker for Artifact Registry authentication # as described here: https://cloud.google.com/artifact-registry/docs/docker/authentication -image = docker.Image( +image = docker_build.Image( "image", - image_name=pulumi.Output.concat(repo_url, "/", image_name), - build=docker.DockerBuildArgs( - context=app_path, - # Cloud Run currently requires x86_64 images - # https://cloud.google.com/run/docs/container-contract#languages - platform="linux/amd64" + tags=[pulumi.Output.concat(repo_url, "/", image_name)], + context=docker_build.BuildContextArgs( + location=app_path, ), + # Cloud Run currently requires x86_64 images + # https://cloud.google.com/run/docs/container-contract#languages + platforms=[docker_build.Platform.LINUX_AMD64], ) # Create a Cloud Run service definition. diff --git a/container-gcp-python/requirements.txt b/container-gcp-python/requirements.txt index a7bdf9c4c..ada37e8ec 100644 --- a/container-gcp-python/requirements.txt +++ b/container-gcp-python/requirements.txt @@ -1,4 +1,4 @@ pulumi>=3.0.0,<4.0.0 pulumi-gcp>=7.0.0,<8.0.0 -pulumi-docker>=4.0.0,<5.0.0 +pulumi-docker-build>=0.0.0,<1.0.0 pulumi-random >=4.0.0,<5.0.0 diff --git a/container-gcp-typescript/index.ts b/container-gcp-typescript/index.ts index a824c2473..b381c27f7 100644 --- a/container-gcp-typescript/index.ts +++ b/container-gcp-typescript/index.ts @@ -1,6 +1,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as gcp from "@pulumi/gcp"; -import * as docker from "@pulumi/docker"; +import * as dockerbuild from "@pulumi/docker-build"; import * as random from "@pulumi/random"; // Import the program's configuration settings. @@ -41,17 +41,14 @@ let repoUrl = pulumi.concat(location, "-docker.pkg.dev/", project, "/", reposito // Create a container image for the service. // Before running `pulumi up`, configure Docker for authentication to Artifact Registry // as described here: https://cloud.google.com/artifact-registry/docs/docker/authentication -const image = new docker.Image("image", { - imageName: pulumi.concat(repoUrl, "/", imageName), - build: { - context: appPath, - platform: "linux/amd64", - args: { - // Cloud Run currently requires x86_64 images - // https://cloud.google.com/run/docs/container-contract#languages - DOCKER_DEFAULT_PLATFORM: "linux/amd64", - }, +const image = new dockerbuild.Image("image", { + tags: [pulumi.concat(repoUrl, "/", imageName)], + context: { + location: appPath, }, + // Cloud Run currently requires x86_64 images + // https://cloud.google.com/run/docs/container-contract#languages + platforms: ["linux/amd64"], }); // Create a Cloud Run service definition. diff --git a/container-gcp-typescript/package.json b/container-gcp-typescript/package.json index 54b5d9ab7..ee06def83 100644 --- a/container-gcp-typescript/package.json +++ b/container-gcp-typescript/package.json @@ -6,7 +6,7 @@ "typescript": "^5.0.0" }, "dependencies": { - "@pulumi/docker": "^4.2.3", + "@pulumi/docker-build": "^0.0.6", "@pulumi/gcp": "^7.0.0", "@pulumi/random": "^4.0.0", "@pulumi/pulumi": "^3.113.0"