Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
D-w-nJ committed Sep 16, 2023
1 parent 88e92c1 commit a996db7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 65 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,46 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'

## gradlew 의 권한을 줍니다.
- name: Grant execute permission for gradlew
run: chmod +x gradlew

## gradle build
- name: Build with Gradle
run: ./gradlew clean build -x test

## AWS에 로그인
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
## ECR에 이미지 업로드
- name: Build, tag, and push image to Amazon ECR
id: build-and-push

## ECR에 로그인
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

## ECR에 이미지 업로드
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: be-repo
IMAGE_TAG: release
run: |
docker build -t be-repo .
docker tag be-repo 224066583965.dkr.ecr.ap-northeast-2.amazonaws.com/be-repo
docker push 224066583965.dkr.ecr.ap-northeast-2.amazonaws.com/be-repo
echo "IMAGE=224066583965.dkr.ecr.ap-northeast-2.amazonaws.com/be-repo" >> $GITHUB_ENV
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV
## ECS task 정의
- name: Push the image ID in the ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: be-container
container-name: backend-container
image: ${{ env.IMAGE }}
## ECS 실행
- name: Deploy ECS task definition
Expand Down
62 changes: 5 additions & 57 deletions task-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"logDriver": "awslogs",
"secretOptions": null,
"options": {
"awslogs-group": "/ecs/be-task",
"awslogs-group": "/ecs/backend-task",
"awslogs-region": "ap-northeast-2",
"awslogs-stream-prefix": "ecs"
}
Expand All @@ -33,11 +33,11 @@
"workingDirectory": null,
"secrets": null,
"dockerSecurityOptions": null,
"memory": 1000,
"memory": null,
"memoryReservation": 500,
"volumesFrom": [],
"stopTimeout": null,
"image": "224066583965.dkr.ecr.ap-northeast-2.amazonaws.com/be-repo",
"image": "224066583965.dkr.ecr.ap-northeast-2.amazonaws.com/be-repo:release",
"startTimeout": null,
"firelensConfiguration": null,
"dependsOn": null,
Expand All @@ -54,71 +54,19 @@
"dockerLabels": null,
"systemControls": null,
"privileged": null,
"name": "be-container"
"name": "backend-container"
}
],
"placementConstraints": [],
"memory": null,
"taskRoleArn": "arn:aws:iam::224066583965:role/AWSECSTaskExecutionRole",
"compatibilities": [
"EXTERNAL",
"EC2"
],
"taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:224066583965:task-definition/be-task:9",
"family": "be-task",
"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.ecr-auth"
},
{
"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.task-iam-role"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "ecs.capability.execution-role-ecr-pull"
}
],
"family": "backend-task",
"pidMode": null,
"requiresCompatibilities": [
"EC2"
],
"networkMode": "bridge",
"runtimePlatform": null,
"cpu": null,
"revision": 9,
"status": "ACTIVE",
"inferenceAccelerators": null,
"proxyConfiguration": null,
"volumes": []
Expand Down

0 comments on commit a996db7

Please sign in to comment.