Skip to content

Commit

Permalink
modify doker image uri
Browse files Browse the repository at this point in the history
  • Loading branch information
larisa17 committed Jul 1, 2024
1 parent ed9cf9a commit faecb1b
Showing 1 changed file with 71 additions and 65 deletions.
136 changes: 71 additions & 65 deletions infra/aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,77 +198,83 @@ const albListenerRule = new aws.lb.ListenerRule(`scroll-badge-service-https`, {
//////////////////////////////////////////////////////////////
// ECS Task & Service
//////////////////////////////////////////////////////////////
const taskDefinition = new aws.ecs.TaskDefinition(`scroll-badge-service-td`, {
family: `scroll-badge-service-td`,
containerDefinitions: JSON.stringify([

const service_data = DOCKER_SCROLL_SERVICE_IMAGE.apply((drk_image) => {
const taskDefinition = new aws.ecs.TaskDefinition(`scroll-badge-service-td`, {
family: `scroll-badge-service-td`,
containerDefinitions: JSON.stringify([
{
name: "scroll-badge-service",
image: drk_image,
cpu: 512,
memory: 1024,
links: [],
essential: true,
portMappings: [
{
containerPort: 80,
hostPort: 80,
protocol: "tcp",
},
],
environment: [],
logConfiguration: {
logDriver: "awslogs",
options: {
"awslogs-group": "scroll-badge-service", // "${serviceLogGroup.name}`,
"awslogs-region": "us-west-2", // `${regionId}`,
"awslogs-create-group": "true",
"awslogs-stream-prefix": "scroll",
},
},
secrets: getIamSecrets(SCROLL_SECRETS_ARN, VC_SECRETS_ARN),
mountPoints: [],
volumesFrom: [],
},
]),
executionRoleArn: serviceRole.arn,
cpu: "512",
memory: "1024",
networkMode: "awsvpc",
requiresCompatibilities: ["FARGATE"],
tags: {
...defaultTags,
EcsService: `scroll-badge-service`,
},
});

const service = new aws.ecs.Service(
`scroll-badge-service`,
{
name: "scroll-badge-service",
image: DOCKER_SCROLL_SERVICE_IMAGE,
cpu: 512,
memory: 1024,
links: [],
essential: true,
portMappings: [
cluster: passportClusterArn,
desiredCount: stack === "production" ? 2 : 1,
enableEcsManagedTags: true,
enableExecuteCommand: false,
launchType: "FARGATE",
loadBalancers: [
{
containerName: "scroll-badge-service",
containerPort: 80,
hostPort: 80,
protocol: "tcp",
targetGroupArn: albTargetGroup.arn,
},
],
environment: [],
logConfiguration: {
logDriver: "awslogs",
options: {
"awslogs-group": "scroll-badge-service", // "${serviceLogGroup.name}`,
"awslogs-region": "us-west-2", // `${regionId}`,
"awslogs-create-group": "true",
"awslogs-stream-prefix": "scroll",
},
name: `scroll-badge-service`,
networkConfiguration: {
subnets: vpcPrivateSubnets,
securityGroups: [serviceSG.id],
},
propagateTags: "TASK_DEFINITION",
taskDefinition: taskDefinition.arn,
tags: {
...defaultTags,
Name: `scroll-badge-service`,
},
secrets: getIamSecrets(SCROLL_SECRETS_ARN, VC_SECRETS_ARN),
mountPoints: [],
volumesFrom: [],
},
]),
executionRoleArn: serviceRole.arn,
cpu: "512",
memory: "1024",
networkMode: "awsvpc",
requiresCompatibilities: ["FARGATE"],
tags: {
...defaultTags,
EcsService: `scroll-badge-service`,
},
{
dependsOn: [albTargetGroup, taskDefinition],
}
);
return { taskDefinition, service };
});

const service = new aws.ecs.Service(
`scroll-badge-service`,
{
cluster: passportClusterArn,
desiredCount: stack === "production" ? 2 : 1,
enableEcsManagedTags: true,
enableExecuteCommand: false,
launchType: "FARGATE",
loadBalancers: [
{
containerName: "scroll-badge-service",
containerPort: 80,
targetGroupArn: albTargetGroup.arn,
},
],
name: `scroll-badge-service`,
networkConfiguration: {
subnets: vpcPrivateSubnets,
securityGroups: [serviceSG.id],
},
propagateTags: "TASK_DEFINITION",
taskDefinition: taskDefinition.arn,
tags: {
...defaultTags,
Name: `scroll-badge-service`,
},
},
{
dependsOn: [albTargetGroup, taskDefinition],
}
);
export const taskDefinitionRevision = service_data.taskDefinition.revision;

0 comments on commit faecb1b

Please sign in to comment.