From d21e41fb41150bbe0a3a5b39d8a86e9e9140229f Mon Sep 17 00:00:00 2001 From: Lairon Acosta Guardias Date: Wed, 31 Mar 2021 22:27:06 -0500 Subject: [PATCH] adding aws yml to deploy to ecs in aws --- .github/workflows/aws.yml | 10 ++-- task-definition.json | 118 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 task-definition.json diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index 8b10116..c8db1fd 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -32,8 +32,8 @@ name: Deploy to Amazon ECS jobs: deploy: name: Deploy - runs-on: ubuntu-latest - environment: production + runs-on: alpine-latest + environment: develop steps: - name: Checkout @@ -54,7 +54,7 @@ jobs: id: build-image env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: my-ecr-repo + ECR_REPOSITORY: dev-repos IMAGE_TAG: ${{ github.sha }} run: | # Build a docker container and @@ -69,13 +69,13 @@ jobs: uses: aws-actions/amazon-ecs-render-task-definition@v1 with: task-definition: task-definition.json - container-name: sample-app + container-name: alpine image: ${{ steps.build-image.outputs.image }} - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1 with: task-definition: ${{ steps.task-def.outputs.task-definition }} - service: sample-app-service + service: alpine-service cluster: default wait-for-service-stability: true diff --git a/task-definition.json b/task-definition.json new file mode 100644 index 0000000..e53acb0 --- /dev/null +++ b/task-definition.json @@ -0,0 +1,118 @@ +{ + "ipcMode": null, + "executionRoleArn": "arn:aws:iam::027479467189:role/ecsTaskExecutionRole", + "containerDefinitions": [ + { + "dnsSearchDomains": null, + "environmentFiles": null, + "logConfiguration": { + "logDriver": "awslogs", + "secretOptions": null, + "options": { + "awslogs-group": "/ecs/ms-gin-go-task-definition", + "awslogs-region": "us-east-2", + "awslogs-stream-prefix": "ecs" + } + }, + "entryPoint": [], + "portMappings": [ + { + "hostPort": 80, + "protocol": "tcp", + "containerPort": 80 + } + ], + "command": [], + "linuxParameters": null, + "cpu": 256, + "environment": [], + "resourceRequirements": null, + "ulimits": null, + "dnsServers": null, + "mountPoints": [], + "workingDirectory": null, + "secrets": null, + "dockerSecurityOptions": null, + "memory": null, + "memoryReservation": 512, + "volumesFrom": [], + "stopTimeout": null, + "image": "alpine:latest", + "startTimeout": null, + "firelensConfiguration": null, + "dependsOn": null, + "disableNetworking": null, + "interactive": null, + "healthCheck": null, + "essential": true, + "links": [], + "hostname": null, + "extraHosts": null, + "pseudoTerminal": null, + "user": null, + "readonlyRootFilesystem": null, + "dockerLabels": null, + "systemControls": null, + "privileged": null, + "name": "alpine" + } + ], + "placementConstraints": [], + "memory": "512", + "taskRoleArn": null, + "compatibilities": [ + "EC2", + "FARGATE" + ], + "taskDefinitionArn": "arn:aws:ecs:us-east-2:027479467189:task-definition/ms-gin-go-task-definition:1", + "family": "ms-gin-go-task-definition", + "requiresAttributes": [ + { + "targetId": null, + "targetType": null, + "value": null, + "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" + }, + { + "targetId": null, + "targetType": null, + "value": null, + "name": "ecs.capability.execution-role-awslogs" + }, + { + "targetId": null, + "targetType": null, + "value": null, + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" + }, + { + "targetId": null, + "targetType": null, + "value": null, + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21" + }, + { + "targetId": null, + "targetType": null, + "value": null, + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" + }, + { + "targetId": null, + "targetType": null, + "value": null, + "name": "ecs.capability.task-eni" + } + ], + "pidMode": null, + "requiresCompatibilities": [ + "FARGATE" + ], + "networkMode": "awsvpc", + "cpu": "256", + "revision": 1, + "status": "ACTIVE", + "inferenceAccelerators": null, + "proxyConfiguration": null, + "volumes": [] +} \ No newline at end of file