-
-
Save thekarel/f8701649097eaf450d96bdf889db6d7c to your computer and use it in GitHub Desktop.
Pulumi GCP image vs service update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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