https://pulumi.com logo
Title
m

melodic-room-61098

02/14/2023, 10:49 AM
Hello #google-cloud. I've created a simple GCP Run service based on https://github.com/pulumi/examples/tree/master/gcp-ts-docker-gcr-cloudrun. I'm using a single
index.ts
and ran into an issue: the container image is being build and uploaded in parallel with the service update. This means that the service can only see the older image and won't update. So I have to run
pulumi up
2x, which is not ideal. Is there a way to declare this dependency in code? This is roughly what I have now: https://gist.github.com/thekarel/f8701649097eaf450d96bdf889db6d7c I've thought of using
pulumi up --parallell 1
(might slow things down) or putting the image and service in different folders (makes
up
more cumbersome). Any thoughts?
If anyone stumbles upon this: when building the docker image and deploying a service in one go, you don't need to worry about the remote docker image. So forget about
docker.RemoteImage
and
docker.getRegistryImage
, just pass the name of the new, locally built image to the container:
containers: [
  {
     image: localDockerImage.imageName,
  }
],
The image still needs to be tagged with
<http://gcri.io|gcri.io>
so it's pushed to the registry, but otherwise it's just a matter of build & deploy.