From ac97a106652d4690ed6b379062f30941a8a36e11 Mon Sep 17 00:00:00 2001 From: diana esteves Date: Fri, 10 May 2024 15:02:28 -0500 Subject: [PATCH 1/7] tested container-azure-python --- container-azure-python/__main__.py | 21 +++++++++++---------- container-azure-python/requirements.txt | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/container-azure-python/__main__.py b/container-azure-python/__main__.py index 87154c38c..1ba072dbb 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,19 @@ 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", + push=True, + tags=[pulumi.Output.concat(registry.login_server, f"/{image_name}:{image_tag}")], + platforms=[docker_build.Platform.LINUX_AMD64], + context=docker_build.BuildContextArgs( + location=app_path, ), - registry=docker.RegistryArgs( - server=registry.login_server, + 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. @@ -77,7 +78,7 @@ containers=[ containerinstance.ContainerArgs( name=image_name, - image=image.image_name, + image=image.ref, ports=[ containerinstance.ContainerPortArgs( port=container_port, diff --git a/container-azure-python/requirements.txt b/container-azure-python/requirements.txt index 2affa6491..77dd50531 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.1,<1.0.0 \ No newline at end of file From 209ba8b3542d441b5ed95673eaf4407564deafb9 Mon Sep 17 00:00:00 2001 From: diana esteves Date: Fri, 10 May 2024 15:22:44 -0500 Subject: [PATCH 2/7] tested container-gcp-python --- container-gcp-python/__main__.py | 19 ++++++++++--------- container-gcp-python/requirements.txt | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/container-gcp-python/__main__.py b/container-gcp-python/__main__.py index 57f575d1e..453c483dc 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,14 +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( +# Example, +# gcloud auth configure-docker us-central1-docker.pkg.dev +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" + push=True, + tags=[pulumi.Output.concat(repo_url, "/", image_name)], + platforms=[docker_build.Platform.LINUX_AMD64], + context=docker_build.BuildContextArgs( + location=app_path, ), ) @@ -73,7 +74,7 @@ spec=cloudrun.ServiceTemplateSpecArgs( containers=[ cloudrun.ServiceTemplateSpecContainerArgs( - image=image.repo_digest, + image=image.digest, resources=cloudrun.ServiceTemplateSpecContainerResourcesArgs( limits=dict( memory=memory, diff --git a/container-gcp-python/requirements.txt b/container-gcp-python/requirements.txt index a7bdf9c4c..b15a60d02 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-random >=4.0.0,<5.0.0 +pulumi-random>=4.0.0,<5.0.0 +pulumi-docker-build>=0.0.1,<1.0.0 \ No newline at end of file From afee28040e91c89182a5fa144b7820d97be1d609 Mon Sep 17 00:00:00 2001 From: diana esteves Date: Fri, 10 May 2024 15:34:57 -0500 Subject: [PATCH 3/7] tested container-gcp-python with pulumi up --- container-gcp-python/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container-gcp-python/__main__.py b/container-gcp-python/__main__.py index 453c483dc..30b02ae22 100644 --- a/container-gcp-python/__main__.py +++ b/container-gcp-python/__main__.py @@ -74,7 +74,7 @@ spec=cloudrun.ServiceTemplateSpecArgs( containers=[ cloudrun.ServiceTemplateSpecContainerArgs( - image=image.digest, + image=image.ref, resources=cloudrun.ServiceTemplateSpecContainerResourcesArgs( limits=dict( memory=memory, From 971d1eb9567478afca41ae02a22ad0e0bd63a922 Mon Sep 17 00:00:00 2001 From: diana esteves Date: Fri, 10 May 2024 15:55:19 -0500 Subject: [PATCH 4/7] tested container-azure-typescript with pulumi up --- container-azure-typescript/index.ts | 35 +++++++++++++------------ container-azure-typescript/package.json | 12 ++++----- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/container-azure-typescript/index.ts b/container-azure-typescript/index.ts index 331df6f8a..d8a6bf441 100644 --- a/container-azure-typescript/index.ts +++ b/container-azure-typescript/index.ts @@ -1,9 +1,9 @@ -import * as pulumi from "@pulumi/pulumi"; -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 containerregistry from "@pulumi/azure-native/containerregistry"; +import * as dockerBuild from "@pulumi/docker-build"; +import * as pulumi from "@pulumi/pulumi"; import * as random from "@pulumi/random"; -import * as docker from "@pulumi/docker"; +import * as resources from "@pulumi/azure-native/resources"; // Import the program's configuration settings. const config = new pulumi.Config(); @@ -38,24 +38,25 @@ 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", { + push: true, + tags: [pulumi.interpolate`${registry.loginServer}/${imageName}:${imageTag}`], + platforms: [dockerBuild.Platform.Linux_amd64], + context: { + location: appPath }, - registry: { - server: registry.loginServer, + registries: [{ + address: registry.loginServer, username: credentials.username, password: credentials.password, - }, + }], }); // Use a random string to give the service a unique DNS name. const dnsName = new random.RandomString("dns-name", { length: 8, special: false, -}).result.apply(result => `${imageName}-${result.toLowerCase()}`); +}).result.apply((result: string) => `${imageName}-${result.toLowerCase()}`); // Create a container group for the service that makes it publicly accessible. const containerGroup = new containerinstance.ContainerGroup("container-group", { @@ -72,7 +73,7 @@ const containerGroup = new containerinstance.ContainerGroup("container-group", { containers: [ { name: imageName, - image: image.imageName, + image: image.ref, ports: [ { port: containerPort, @@ -106,6 +107,6 @@ const containerGroup = new containerinstance.ContainerGroup("container-group", { }); // Export the service's IP address, hostname, and fully-qualified URL. -export const hostname = containerGroup.ipAddress.apply(addr => addr!.fqdn!); -export const ip = containerGroup.ipAddress.apply(addr => addr!.ip!); -export const url = containerGroup.ipAddress.apply(addr => `http://${addr!.fqdn!}:${containerPort}`); +export const hostname = containerGroup.ipAddress.apply((addr: any) => addr!.fqdn!); +export const ip = containerGroup.ipAddress.apply((addr: any) => addr!.ip!); +export const url = containerGroup.ipAddress.apply((addr: any) => `http://${addr!.fqdn!}:${containerPort}`); diff --git a/container-azure-typescript/package.json b/container-azure-typescript/package.json index 910629c6b..dde33e496 100644 --- a/container-azure-typescript/package.json +++ b/container-azure-typescript/package.json @@ -1,13 +1,13 @@ { "name": "${PROJECT}", "devDependencies": { - "@types/node": "^18", - "typescript": "^5.0.0" + "@types/node": "^18.0.0", + "typescript": "^5.4.5" }, "dependencies": { - "@pulumi/azure-native": "^2.0.0", - "@pulumi/docker": "^4.2.3", - "@pulumi/random": "^4.8.2", - "@pulumi/pulumi": "^3.113.0" + "@pulumi/azure-native": "^2.40.0", + "@pulumi/docker-build": "^0.0.2", + "@pulumi/pulumi": "^3.115.2", + "@pulumi/random": "^4.16.1" } } From f6c7cc7ed791c530b59baf1212973d52242e7255 Mon Sep 17 00:00:00 2001 From: diana esteves Date: Fri, 10 May 2024 16:10:12 -0500 Subject: [PATCH 5/7] tested container-gcp-typescript with pulumi up --- container-gcp-typescript/index.ts | 25 ++++++++++++------------- container-gcp-typescript/package.json | 12 ++++++------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/container-gcp-typescript/index.ts b/container-gcp-typescript/index.ts index a824c2473..113e3b4e1 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 dockerBuild from "@pulumi/docker-build"; import * as gcp from "@pulumi/gcp"; -import * as docker from "@pulumi/docker"; +import * as pulumi from "@pulumi/pulumi"; import * as random from "@pulumi/random"; // Import the program's configuration settings. @@ -41,17 +41,16 @@ 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", { + push: true, + tags: [pulumi.concat(repoUrl, "/", imageName)], + context: { + location: appPath, + }, + platforms: [ + dockerBuild.Platform.Linux_amd64 + ], }); // Create a Cloud Run service definition. @@ -61,7 +60,7 @@ const service = new gcp.cloudrun.Service("service", { spec: { containers: [ { - image: image.repoDigest, + image: image.ref, resources: { limits: { memory, diff --git a/container-gcp-typescript/package.json b/container-gcp-typescript/package.json index 54b5d9ab7..ea890bc54 100644 --- a/container-gcp-typescript/package.json +++ b/container-gcp-typescript/package.json @@ -2,13 +2,13 @@ "name": "${PROJECT}", "main": "index.ts", "devDependencies": { - "@types/node": "^18", - "typescript": "^5.0.0" + "@types/node": "^18.19.33", + "typescript": "^5.4.5" }, "dependencies": { - "@pulumi/docker": "^4.2.3", - "@pulumi/gcp": "^7.0.0", - "@pulumi/random": "^4.0.0", - "@pulumi/pulumi": "^3.113.0" + "@pulumi/docker-build": "^0.0.2", + "@pulumi/gcp": "^7.21.2", + "@pulumi/pulumi": "^3.115.2", + "@pulumi/random": "^4.16.1" } } From 12d1475d56f82c24443ff886811816f180c5dbd6 Mon Sep 17 00:00:00 2001 From: diana esteves Date: Fri, 10 May 2024 16:22:28 -0500 Subject: [PATCH 6/7] updated container-[gcp|azure]-typescript --- container-azure-csharp/${PROJECT}.csproj | 2 +- container-azure-csharp/Program.cs | 32 ++++++++++++++---------- container-gcp-csharp/${PROJECT}.csproj | 2 +- container-gcp-csharp/Program.cs | 22 +++++++++------- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/container-azure-csharp/${PROJECT}.csproj b/container-azure-csharp/${PROJECT}.csproj index cf1337143..2828b33c9 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..9363792c9 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(() => @@ -24,7 +24,8 @@ { ResourceGroupName = resourceGroup.Name, AdminUserEnabled = true, - Sku = new AzureNative.ContainerRegistry.Inputs.SkuArgs { + Sku = new AzureNative.ContainerRegistry.Inputs.SkuArgs + { Name = AzureNative.ContainerRegistry.SkuName.Basic, }, }); @@ -39,18 +40,21 @@ 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", + Push = true, + Tags = new[] { Pulumi.Output.Format($"{registry.LoginServer}/{imageName}:{imageTag}") }, + Context = new DockerBuild.Inputs.BuildContextArgs + { + Location = appPath }, - Registry = new Docker.Inputs.RegistryArgs { - Server = registry.LoginServer, + Platforms = new[] { DockerBuild.Platform.Linux_amd64 }, + Registries = new[]{ + new DockerBuild.Inputs.RegistryArgs{ + Address = registry.LoginServer, Username = registryUsername, Password = registryPassword, - }, + }}, }); // Use a random string to give the service a unique DNS name. @@ -66,7 +70,8 @@ ResourceGroupName = resourceGroup.Name, OsType = "linux", RestartPolicy = "always", - ImageRegistryCredentials = new AzureNative.ContainerInstance.Inputs.ImageRegistryCredentialArgs { + ImageRegistryCredentials = new AzureNative.ContainerInstance.Inputs.ImageRegistryCredentialArgs + { Server = registry.LoginServer, Username = registryUsername, Password = registryPassword, @@ -75,7 +80,7 @@ { new AzureNative.ContainerInstance.Inputs.ContainerArgs { Name = imageName, - Image = image.ImageName, + Image = image.Ref, Ports = new[] { new AzureNative.ContainerInstance.Inputs.ContainerPortArgs { @@ -98,7 +103,8 @@ }, }, }, - IpAddress = new AzureNative.ContainerInstance.Inputs.IpAddressArgs { + IpAddress = new AzureNative.ContainerInstance.Inputs.IpAddressArgs + { Type = AzureNative.ContainerInstance.ContainerGroupIpAddressType.Public, DnsNameLabel = dnsName, Ports = new[] diff --git a/container-gcp-csharp/${PROJECT}.csproj b/container-gcp-csharp/${PROJECT}.csproj index ce8f83aa9..7074fa353 100644 --- a/container-gcp-csharp/${PROJECT}.csproj +++ b/container-gcp-csharp/${PROJECT}.csproj @@ -10,8 +10,8 @@ + - diff --git a/container-gcp-csharp/Program.cs b/container-gcp-csharp/Program.cs index 177fbc66a..e996f3314 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,15 +47,19 @@ // 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, - // Cloud Run currently requires x86_64 images - // https://cloud.google.com/run/docs/container-contract#languages - Platform = "linux/amd64", + Push = true, + Tags = new[]{ + Output.Format($"{repoUrl}/{imageName}"), }, + Context = new DockerBuild.Inputs.BuildContextArgs + { + Location = appPath + }, + // Cloud Run currently requires x86_64 images + // https://cloud.google.com/run/docs/container-contract#languages + Platforms = new[] { DockerBuild.Platform.Linux_amd64 } }); // Create a Cloud Run service definition. @@ -70,7 +74,7 @@ { new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs { - Image = image.RepoDigest, + Image = image.Ref, Resources = new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerResourcesArgs { Limits = { From 84224ba7ffc402351b8537cb12550d5896f910be Mon Sep 17 00:00:00 2001 From: diana esteves Date: Fri, 10 May 2024 16:49:05 -0500 Subject: [PATCH 7/7] updated container-[gcp|azure]-go --- container-azure-go/.gitignore | 2 ++ container-azure-go/go.mod | 12 ++++++------ container-azure-go/main.go | 28 ++++++++++++++++----------- container-gcp-go/.gitignore | 2 ++ container-gcp-go/go.mod | 3 ++- container-gcp-go/main.go | 22 +++++++++++---------- container-gcp-typescript/package.json | 2 +- 7 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 container-azure-go/.gitignore create mode 100644 container-gcp-go/.gitignore diff --git a/container-azure-go/.gitignore b/container-azure-go/.gitignore new file mode 100644 index 000000000..d1147c649 --- /dev/null +++ b/container-azure-go/.gitignore @@ -0,0 +1,2 @@ +go.work +go.work.sum \ No newline at end of file diff --git a/container-azure-go/go.mod b/container-azure-go/go.mod index 246f2ee97..813a92ef5 100644 --- a/container-azure-go/go.mod +++ b/container-azure-go/go.mod @@ -3,10 +3,10 @@ module ${PROJECT} go 1.20 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-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-azure-native-sdk/containerinstance/v2 v2.40.0 + github.com/pulumi/pulumi-azure-native-sdk/containerregistry/v2 v2.40.0 + github.com/pulumi/pulumi-azure-native-sdk/resources/v2 v2.40.0 + github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild v0.0.0-20240501144927-9b789f374285 + github.com/pulumi/pulumi-random/sdk/v4 v4.16.1 + github.com/pulumi/pulumi/sdk/v3 v3.115.2 ) diff --git a/container-azure-go/main.go b/container-azure-go/main.go index a539a42d4..e0645d453 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,17 +70,23 @@ 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{ + Push: pulumi.Bool(true), + Tags: pulumi.StringArray{ + pulumi.Sprintf("%s/%s:%s", registry.LoginServer, imageName, imageTag), }, - Registry: docker.RegistryArgs{ - Server: registry.LoginServer, - Username: registryUsername, - Password: registryPassword, + Context: &dockerbuild.BuildContextArgs{ + Location: pulumi.String(appPath), }, + Platforms: dockerbuild.PlatformArray{ + dockerbuild.Platform_Linux_amd64, + }, + Registries: dockerbuild.RegistryArray{ + &dockerbuild.RegistryArgs{ + Address: registry.LoginServer, + Username: registryUsername, + Password: registryPassword, + }}, }) if err != nil { return err @@ -113,7 +119,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-gcp-go/.gitignore b/container-gcp-go/.gitignore new file mode 100644 index 000000000..d1147c649 --- /dev/null +++ b/container-gcp-go/.gitignore @@ -0,0 +1,2 @@ +go.work +go.work.sum \ No newline at end of file diff --git a/container-gcp-go/go.mod b/container-gcp-go/go.mod index 340888c5c..dee998b5b 100644 --- a/container-gcp-go/go.mod +++ b/container-gcp-go/go.mod @@ -3,7 +3,8 @@ module ${PROJECT} go 1.20 require ( + github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild v0.0.0-20240501144927-9b789f374285 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.113.3 ) diff --git a/container-gcp-go/main.go b/container-gcp-go/main.go index d283ec3de..b19ebe488 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,14 +76,16 @@ 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{ + Push: pulumi.Bool(true), + Tags: pulumi.StringArray{ + pulumi.Sprintf("%s/%s", repoUrl, imageName) + }, + Context: &dockerbuild.BuildContextArgs{ + Location: pulumi.String(appPath), + }, + Platforms: dockerbuild.PlatformArray{ + dockerbuild.Platform_Linux_amd64, }, }) if err != nil { @@ -97,7 +99,7 @@ func main() { Spec: cloudrun.ServiceTemplateSpecArgs{ Containers: cloudrun.ServiceTemplateSpecContainerArray{ cloudrun.ServiceTemplateSpecContainerArgs{ - Image: image.RepoDigest.Elem(), + Image: image.Ref, Resources: cloudrun.ServiceTemplateSpecContainerResourcesArgs{ Limits: pulumi.ToStringMap(map[string]string{ "memory": memory, diff --git a/container-gcp-typescript/package.json b/container-gcp-typescript/package.json index ea890bc54..5acce788a 100644 --- a/container-gcp-typescript/package.json +++ b/container-gcp-typescript/package.json @@ -2,7 +2,7 @@ "name": "${PROJECT}", "main": "index.ts", "devDependencies": { - "@types/node": "^18.19.33", + "@types/node": "^18.0.0", "typescript": "^5.4.5" }, "dependencies": {