diff --git a/container-azure-go/.gitignore b/container-azure-go/.gitignore new file mode 100644 index 00000000..d1147c64 --- /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 246f2ee9..813a92ef 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 a539a42d..e0645d45 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 00000000..d1147c64 --- /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 340888c5..dee998b5 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 d283ec3d..b19ebe48 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 ea890bc5..5acce788 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": {