diff --git a/.github/workflows/deploy_ecs.yml b/.github/workflows/deploy_ecs.yml index fcca255..bc70307 100644 --- a/.github/workflows/deploy_ecs.yml +++ b/.github/workflows/deploy_ecs.yml @@ -38,11 +38,11 @@ jobs: docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" - - - name: Deploy Amazon ECS task definition - uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@v1 with: - task-definition: ${{ steps.task-def.outputs.task-definition }} - service: ecs-devops-sandbox-service - cluster: ecs-devops-sandbox-cluster - wait-for-service-stability: true + task-definition: task-definition.json + container-name: dittodining + image: ${{ steps.build-image.outputs.image }} \ No newline at end of file diff --git a/task-definition.json b/task-definition.json new file mode 100644 index 0000000..520a50c --- /dev/null +++ b/task-definition.json @@ -0,0 +1,55 @@ +{ + "containerDefinitions": [ + { + "name": "dittodining", + "image": "954976319012.dkr.ecr.ap-northeast-2.amazonaws.com/dittodining:latest", + "cpu": 0, + "portMappings": [ + { + "name": "server", + "containerPort": 8080, + "hostPort": 8080, + "protocol": "tcp", + "appProtocol": "http" + }, + { + "name": "database", + "containerPort": 3306, + "hostPort": 3306, + "protocol": "tcp", + "appProtocol": "http" + } + ], + "essential": true, + "environment": [], + "mountPoints": [], + "volumesFrom": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "/ecs/dittodining", + "mode": "non-blocking", + "awslogs-create-group": "true", + "max-buffer-size": "25m", + "awslogs-region": "ap-northeast-2", + "awslogs-stream-prefix": "ecs" + } + }, + "systemControls": [] + } + ], + "family": "dittodining", + "networkMode": "awsvpc", + "volumes": [], + "placementConstraints": [], + "requiresCompatibilities": [ + "EC2" + ], + "cpu": "256", + "memory": "256", + "runtimePlatform": { + "cpuArchitecture": "X86_64", + "operatingSystemFamily": "LINUX" + }, + "tags": [] +} \ No newline at end of file