Skip to content

Instantly share code, notes, and snippets.

@thekarel
Created February 14, 2023 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thekarel/f8701649097eaf450d96bdf889db6d7c to your computer and use it in GitHub Desktop.
Save thekarel/f8701649097eaf450d96bdf889db6d7c to your computer and use it in GitHub Desktop.
Pulumi GCP image vs service update
const imageNameInRegistry = `${registry}/${registryFolder}/${appName}:latest`
export const image = new docker.Image(appName, {
imageName: imageNameInRegistry,
build: {
context: '../some/folder',
dockerfile: './Dockerfile',
extraOptions: ['--quiet'],
},
})
const gcrRegistryProvider = new docker.Provider('gcr', {
registryAuth: [
{
address: registry,
},
],
})
const registryImage = pulumi.output(
docker.getRegistryImage({name: imageNameInRegistry}, {provider: gcrRegistryProvider}),
)
const dockerImage = registryImage.apply(
(r) =>
new docker.RemoteImage(
`${imageName}-docker-image`,
{
name: r.name,
pullTriggers: [registryImage.sha256Digest],
keepLocally: true,
},
{provider: gcrRegistryProvider},
),
)
export const service = new gcp.cloudrunv2.Service(`${appName}-${stackName}`, {
location,
ingress: 'INGRESS_TRAFFIC_ALL',
template: {
containers: [
{
image: dockerImage.repoDigest,
},
],
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment