sparse-intern-71089
09/30/2019, 8:13 PMacoustic-noon-6208
09/30/2019, 8:13 PMconst repositoryApi = new aws.ecr.Repository(apiRepoName,
{
name: apiRepoName
}
);
// Build and publish a Docker image to a private ECR registry.
const apiImage = awsx.ecs.Image.fromDockerBuild(repositoryApi, {
context: config.dockerContextPath,
dockerfile: config.dockerAPIFile
});
Note: The reason I am doing it that way is because Dockerfile located in different folder to rest of the content, so needs to use fromDockerBuild instead of buildAndPushImage which seems does not support different path to docker file.acoustic-noon-6208
09/30/2019, 8:15 PMconst container = {
name,
image,
ports: [{ name: "http", containerPort: backendPort }],
};
const deployment = new k8s.apps.v1.Deployment(name,
{
metadata: {
namespace: namespaceName,
labels: appLabels,
},
spec: {
replicas: 1,
selector: { matchLabels: appLabels },
template: {
metadata: {
labels: appLabels,
},
spec: {
containers: [
container
],
},
},
},
},
{
provider: cluster.provider,
}
);
acoustic-noon-6208
09/30/2019, 8:15 PMacoustic-noon-6208
09/30/2019, 8:16 PMapiImage
because it's of different type (awsx.ecs.Image
vs aws.ecr.RepositoryImage
)acoustic-noon-6208
09/30/2019, 8:17 PMacoustic-noon-6208
09/30/2019, 8:18 PMGetImageResult
acoustic-noon-6208
09/30/2019, 8:18 PMacoustic-noon-6208
09/30/2019, 8:20 PMconst image = awsx.ecr.buildAndPushImage(apiRepoName, config.dockerContextPath, {
}, {
}).image();
because seems it does not support different path to dockerfile / context pathacoustic-noon-6208
09/30/2019, 8:20 PMacoustic-noon-6208
09/30/2019, 8:56 PM${image.registry}/${image.repository}:${image.tag}
, but I am not sure how to get say image.tag from just uploaded image with fromDockerBuild
etccreamy-potato-29402
09/30/2019, 9:24 PMacoustic-noon-6208
09/30/2019, 9:26 PMacoustic-noon-6208
09/30/2019, 9:26 PMconst apiImage = awsx.ecs.Image.fromDockerBuild(....)
. How to get image Tag from it? (or better full URN to image)creamy-potato-29402
09/30/2019, 9:27 PMacoustic-noon-6208
10/06/2019, 12:07 PM