Skip to content

Feat: 카테고리 전체조회 API 작성 (#28) #16

Feat: 카테고리 전체조회 API 작성 (#28)

Feat: 카테고리 전체조회 API 작성 (#28) #16

Workflow file for this run

name: CI/CD using github actions & docker
on:
push:
branches: [ "dev"]
pull_request:
branches: [ "dev"]
jobs:
build:
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'
# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: make application-private.properties
run: |
cd ./src/main/resources
touch ./application-private.properties
echo "${{ secrets.properties }}" > ./application-private.properties # github actions에서 설정한 값을 application-private.properties 파일에 쓰기
shell: bash
- name: Grant execute permission to Gradle wrapper
run: chmod +x ./gradlew
- name: Build with Gradle Wrapper
run: ./gradlew build
- name: dev Docker build & push to prod
if: contains(github.ref, 'dev')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/hanaro-starbucks .
docker push ${{ secrets.DOCKER_USERNAME }}/hanaro-starbucks
- name: Deploy to dev
uses: appleboy/ssh-action@master
id: deploy-dev
if: contains(github.ref, 'dev')
with:
host: ${{ secrets.HOST_DEV }} # EC2 퍼블릭 IPv4 DNS
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo docker ps
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/hanaro-starbucks
sudo docker stop hanaro-starbucks
sudo docker rm hanaro-starbucks
sudo docker run -it -d -p 8080:8080 --name hanaro-starbucks ${{ secrets.DOCKER_USERNAME }}/hanaro-starbucks
sudo docker image prune -f