in spec/fixtures/cdk/no_db/rails-no-db-fargate-stack.ts [19:54]
constructor(scope: cdk.App, id: string, props: RailsNoDbFargateStackProps) {
super(scope, id);
// import resources
const cluster = props.cluster;
const asset = new ecr_assets.DockerImageAsset(this, 'ImageAssetBuild', {
directory: '/absolute/path/to/dir/path/to/rails'
});
// compute repo name from asset image
const parts = asset.imageUri.split("@")[0].split("/");
const repoName = parts.slice(1, parts.length).join("/").split(":")[0];
this.repoName = repoName;
const image = ecs.ContainerImage.fromDockerImageAsset(asset);
// Fargate service
const lbFargate = new ecs_patterns.ApplicationLoadBalancedFargateService(this, 'LBFargate', {
serviceName: 'RailsNoDb',
cluster: cluster,
taskImageOptions: {
image: image,
containerName: 'FargateTaskContainer',
containerPort: 80,
environment: {
'RAILS_LOG_TO_STDOUT': 'true',
},
enableLogging: true,
},
memoryLimitMiB: 512,
cpu: 256,
desiredCount: 1,
});
this.service = lbFargate.service;
}