sparse-intern-71089
11/08/2022, 7:51 PMmillions-furniture-75402
11/08/2022, 9:26 PMmillions-furniture-75402
11/08/2022, 9:29 PMextraOptions
to pass --tag
millions-furniture-75402
11/08/2022, 9:36 PM--tag
flag
https://github.com/pulumi/pulumi-awsx/blob/master/awsx-classic/ecr/repository.ts#L51 -- takes a docker.DockerBuild
https://www.pulumi.com/registry/packages/docker/api-docs/image/#dockerbuild
(untested):
const containerRepository = new awsx.ecr.Repository(`${appName}-image`, {
repository: new aws.ecr.Repository(`${appName}-image`, {
imageScanningConfiguration: {
scanOnPush: true,
},
imageTagMutability: "MUTABLE",
}),
});
const applicationImage = containerRepository.buildAndPushImage({
env: {
DOCKER_BUILDKIT: "1",
},
extraOptions: ["--tag", "name:1.0.1"],
});
rapid-kite-35
11/09/2022, 8:45 AMpulumi-docker
overwrites the -t tag here: https://github.com/pulumi/pulumi-docker/blob/fa0159258e220cefa6a93d1e1f77676641721365/sdk/nodejs/docker.ts#L470
It uses the image name but if you pass in a DockerBuild
it generates the image name of the signature with no apparent way to overwrite it ( https://github.com/pulumi/pulumi-awsx/blob/master/awsx-classic/ecs/image.ts#L169 )
But I think I can get the credentials the same way awsx-classic
does and pass it directly to pulumi-docker
and hopefully that works.
Odd though how difficult it is to tag an image...rapid-kite-35
11/09/2022, 10:51 AMconst credentials = aws.ecr.getCredentialsOutput({
registryId: repo.registryId
})
const transformCredentials = (creds: pulumi.Output<aws.ecr.GetCredentialsResult>): pulumi.Output<docker.ImageRegistry> => {
return creds.apply(c => {
const decodedCredentials = Buffer.from(c.authorizationToken, "base64").toString();
const [username, password] = decodedCredentials.split(":");
if (!password || !username) {
throw new Error("Invalid credentials");
}
return {
server: c.proxyEndpoint,
username: username,
password: password,
} as docker.ImageRegistry
})
}
const image = new docker.Image(customImage, {
build: {
context: '../',
args: buildArgs
},
registry: transformCredentials(credentials),
imageName: pulumi.interpolate`${imageName}:${env}`,
});
millions-furniture-75402
11/09/2022, 1:31 PMmillions-furniture-75402
11/09/2022, 1:33 PM--tag
flags.
https://github.com/pulumi/pulumi-docker/blob/fa0159258e220cefa6a93d1e1f77676641721365/sdk/nodejs/docker.ts#L465-L467