Skip to content

Update deployment.yaml #35

Update deployment.yaml

Update deployment.yaml #35

Workflow file for this run

name: CICD TO ECS
on:
push:
branches:
- main
env:
# AWS_REGION: ap-northeast-2
AWS_REGION: us-east-1
ECR_URL: 534420079206.dkr.ecr.us-east-1.amazonaws.com/cicd-test:latest
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: ls -al && ./gradlew build -x test
- name: jar파일 확인
run: ls -al && ls -al build && ls -al build/libs
- name: ECR login
run: aws ecr get-login-password | docker login --username AWS --password-stdin 534420079206.dkr.ecr.us-east-1.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: 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: Deploy to ECS
# run: aws ecs update-service --cluster cicd-test --service cicd-test --task-definition first-run-task-definition:7 --force-new-deployment