https://pulumi.com logo
Title
p

polite-umbrella-11196

02/26/2023, 3:54 AM
If I’m trying to deploy a new image with a specific version, should I do something like this:
const version = require('../../apps/service/package.json').version;
...
const image = new awsx.ecr.Image(`image:${version}`, {
  repositoryUrl: repository.url,
  path: "./app/service/",
});
Or is there a different way to specify the version on the image?
b

billowy-army-68599

02/26/2023, 5:02 PM
awsx.ecr.Image
is designed to build the image locally for you and push it. If the image already exists in the ECR repo and you know the image tag, just specify that in your task definition
p

polite-umbrella-11196

02/26/2023, 5:45 PM
Is there some way of having the image be tagged with a specific version? Specifically I want to be able to "roll back" to a previous version without going through a build process
b

billowy-army-68599

02/26/2023, 6:09 PM
not with
awsx.ecr.Image
no, it auto generates an image tag for you. If you want more control over the image and the process of building/pushing, you likely want to use https://www.pulumi.com/registry/packages/docker/api-docs/image/ which allows you to set a tag in the image name. It’s worth pointing out though, Pulumi drives towards a desired state, so with this:
Specifically I want to be able to “roll back” to a previous version without going through a build process
You’ll probably want to just modify the task definition and do your docker image builds outside Pulumi