This message was deleted.
# general
s
This message was deleted.
d
This is what I'm trying to do:
Copy code
const baseImageProvider: pulumi.dynamic.ResourceProvider = {
  create(inputs) {
    console.log('create', inputs.buildOptions)
    const image = repository.buildAndPushImage(inputs.buildOptions)
    return Promise.resolve({
      id: inputs.hash,
      outs: {
        image,
        hash: inputs.hash,
      },
    });
  },
  update(id, olds, news) {
    if (olds.hash === news.hash) {
      return Promise.resolve({
        outs: olds
      })
    }
    console.log('update', news.buildOptions)
    const image = repository.buildAndPushImage(news.buildOptions)
    return Promise.resolve({
      outs: {
        image,
        hash: news.hash,
      },
    });
  },
};

interface BaseImageProps {
  buildOptions: docker.DockerBuild;
  hash: string;
}

export class BaseImage extends pulumi.dynamic.Resource {
  public readonly image!: pulumi.Output<string>;
  constructor(
    name: string,
    props: BaseImageProps,
    opts?: pulumi.CustomResourceOptions,
  ) {
    super(baseImageProvider, name, { image: undefined, ...props }, opts);
  }
}