future-refrigerator-88869
08/26/2021, 5:54 PMawsx.ecr.Repository
which has a function buildAndPushImage
but it does not allow a lot of configuration for the image. What is the standard for creating images and pushing them to an ECR. Appreciate if someone can point me in the right direction 🙂bumpy-grass-54508
08/26/2021, 6:14 PMpulumi.Docker
can do what you want - it does require the docker cli to be installed on the machine but you don't have to run the cli yourself
https://www.pulumi.com/docs/reference/pkg/docker/image/var ecrRepo = new Pulumi.Aws.Ecr.Repository(...)
var ecrCreds = ecrRepo.RegistryId.Apply(registryId => Pulumi.Aws.Ecr.GetCredentials.InvokeAsync(
new PulumiAws.Ecr.GetCredentialsArgs
{
RegistryId = registryId,
},
invokeOptions));
var registry = ecrCreds.Apply(creds =>
{
var decodedCredentials = Encoding.UTF8.GetString(Convert.FromBase64String(creds.AuthorizationToken)).Split(':');
return new Pulumi.Docker.ImageRegistry
{
Server = creds.ProxyEndpoint,
Username = decodedCredentials[0],
Password = decodedCredentials[1],
};
});
var dockerImage = new Pulumi.Docker.Image("image", new Pulumi.Docker.ImageArgs
{
ImageName = Output.Format($"{ecrRepo.RepositoryUrl}:{your-tag-or-build-id}"),
Registry = registry,
Build = dockerContext (path to dockerfile or other options)
});
then you can stick dockerImage.BaseImageName
in your ECS task definitionfuture-refrigerator-88869
08/26/2021, 6:55 PMregistryId
from the repository creating the ecrs. Then use that to get the credentials i guessbumpy-grass-54508
08/26/2021, 7:13 PM