Using the docker provider, how can I make pulumi o...
# general
d
Using the docker provider, how can I make pulumi only destroy and recreate the container if the image is actually updated?
I've tried doing it like this:
Copy code
const registryImage = docker.getRegistryImage(
  {
    name: "meisnate12/plex-meta-manager",
  },
  dockerProviderOpts
);

const image = new docker.RemoteImage(
  name,
  {
    name: "meisnate12/plex-meta-manager",
    pullTriggers: [
      registryImage.then((registryImage) => registryImage.sha256Digest),
    ],
  },
  dockerProviderOpts
);
But it still wants to update the image every
pulumi up
, if I select
details
it shows this:
Copy code
image: "sha256:9bf92ccb981db90633aef0366ba0d4cc3ee9f50d8d9f2b25599f7e84eeb355fc" => "meisnate12/plex-meta-manager"
r
If you are using it in a CI/CD environment, you can use the Git SHA for tagging the image. This way you can ensure that replacement only happens when there is a new image.
d
Hey, thanks! Isn't that what I'm doing in the pullTrigger?
r
I haven't really tried with pull triggers, my current way is tag image with the Git SHA, so your case would be something like
meisnate12/plex-meta-manager:#{GIT_SHA}#
, so in pipeline, if there is no new commit, Git SHA remains the same and it won't cause building of new image and replacement of image for pods in K8s cluster (for my case)
d
Oh, this isn't my image, so I'm not building/tagging it