Skip to content

Update deployment.yaml #19

Update deployment.yaml

Update deployment.yaml #19

Workflow file for this run

name: CICD TO ECS
on:
push:
branches:
- main
env:
AWS_REGION: ap-northeast-2
ECR_URL: 534420079206.dkr.ecr.ap-northeast-2.amazonaws.com/01_cicid_test:kyh
jobs:
CI:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: JDK 17 설치
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '17'
cache: 'gradle'
- name: Gradle 명령 실행 권한 부여
run: chmod +x ./gradlew
shell: bash
- name: Gradle로 프로젝트 Build
run: ./gradlew build -x test
- name: ECR login
run: aws ecr get-login-password | docker login --username AWS --password-stdin 534420079206.dkr.ecr.ap-northeast-2.amazonaws.com
- name: Container build
run: docker build -t ${{ env.ECR_URL }} .
- name: Container Push
run : docker push ${{ env.ECR_URL }}
CD:
name: Deploy
runs-on: ubuntu-latest
needs: CI
steps:
- name: Deploy to ECS
run: aws ecs update-service --cluster cicd-test --service cicd-test --task-definition first-run-task-definition:5 --force-new-deployment