Skip to content

docs: CD 스크립트 정정 #4

docs: CD 스크립트 정정

docs: CD 스크립트 정정 #4

Workflow file for this run

name: Coduo Backend CD
on:
push:
branches: ["BE/main"]
jobs:
build-and-deploy:
runs-on: coduo-backend-ec2
defaults:
run:
working-directory: ./backend
steps:
- name: checkout
uses: actions/checkout@v3
- name: Make prod application.yml
run: |
rm -rf ./src/main/resources/application.yml
touch ./src/main/resources/application.yml
echo ${{ secrets.BE_PROD_YML }} | base64 --decode > ./src/main/resources/application.yml
shell: bash
- name: Grant Execute Permission For Gradlew
run: chmod +x gradlew
- name: Build With Gradle
run: ./gradlew build -x test
- name: Docker build & Push
run: |
docker login -u ${{ secrets.DOCKER_HUB_ID }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
docker buildx build --platform=linux/arm64 -t ${{ secrets.DOCKER_HUB_REPO }}/springboot-app .
docker push ${{ secrets.DOCKER_HUB_REPO }}/springboot-app
- name: Deploy Images with Docker compose
run: |
docker-compose -f ~/docker-compose.yml down
docker-compose -f ~/docker-compose.yml up -d