Skip to content

[cd] jib 캐싱 테스트 #6

[cd] jib 캐싱 테스트

[cd] jib 캐싱 테스트 #6

Workflow file for this run

name: CD
on:
push:
branches:
- prod
jobs:
deploy:
name: Deploy to AWS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: create secure file
run: |
cd src/main/resources
touch secure.properties
echo "${{ secrets.SECURE }}" >> secure.properties
- 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
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: gradle
- name: Grant execute permission to Gradle Wrapper
run: chmod +x ./gradlew
- name: Cache Jib layers
uses: actions/cache@v3
with:
path: ./build/jib-cache
key: ${{ runner.os }}-jib-${{ github.job }}-${{ hashFiles('build.gradle') }}
restore-keys: ${{ runner.os }}-jib-${{ github.job }}
- name: Build and push image to Amazon ECR
run: ./gradlew jib -x test
- name: Deploy to AWS ECS
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: task-definition.json
cluster: t5-ecs-fargate-cluster
service: t5-batch-service
wait-for-service-stability: true