Skip to content

[Server] fix : 재료 추가시 레시피 갱신 비동기처리 #39

[Server] fix : 재료 추가시 레시피 갱신 비동기처리

[Server] fix : 재료 추가시 레시피 갱신 비동기처리 #39

Workflow file for this run

name: Java CD with Gradle
on:
push:
branches: [ "Server/CD" ]
paths: ["Server/banchango/**"]
pull_request:
types: [closed]
branches: [ "develop", "main" ]
paths: ["Server/banchango/**"]
jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: make application-prod.yml
run: |
cd ./Server/banchango/src/main/resources
touch ./application-prod.properties
echo "${{ secrets.APPLICATION_PROD }}" > ./application-prod.properties
- name: Grant execute permission for gradlew
run: chmod +x ./Server/banchango/gradlew
- name: Build with Gradle
run: |
cd Server/banchango
./gradlew clean build -x test
- name: Docker build
run: |
cd Server/banchango
docker login -u ${{ secrets.SERVER_DOCKER_USERNAME }} -p ${{ secrets.SERVER_DOCKER_PASSWORD }}
docker build -t app .
docker tag app ${{ secrets.SERVER_DOCKER_USERNAME }}/banchango:latest
docker push ${{ secrets.SERVER_DOCKER_USERNAME }}/banchango:latest
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }} # EC2 인스턴스 퍼블릭 DNS
username: ec2-user
key: ${{ secrets.SERVER_PEM_KEY }} # pem 키
# 도커 작업
script: |
docker pull ${{ secrets.SERVER_DOCKER_USERNAME }}/banchango:latest
docker stop $(docker ps -a -q)
docker run -d --log-driver=syslog -p 8080:8080 ${{ secrets.SERVER_DOCKER_USERNAME }}/banchango:latest
docker rm $(docker ps --filter 'status=exited' -a -q)
docker image prune -a -f