https://pulumi.com logo
#general
Title
# general
h

handsome-actor-1155

07/16/2019, 6:41 PM
Just out of curiosity, is this the best way to create an ECR and build/upload an image?
Copy code
const ecr = new aws.ecr.Repository("ecr", {
        name: "stream-app/corrective-action-producer"
    });

    const ecrCreds = ecr.registryId.apply(async (registryId) => {
        const credentials = await aws.ecr.getCredentials({
            registryId: registryId,
        });
        const decodedCredentials = Buffer.from(credentials.authorizationToken, "base64").toString();
        const [username, password] = decodedCredentials.split(":");
        return { server: credentials.proxyEndpoint, username, password };
    });

    return new docker.Image("correctiveActionProducer", {
        imageName: ecr.repositoryUrl,
        build: "./",
        registry: ecrCreds
    });