Skip to content

📝 :: 권한 설정 수정 #104

📝 :: 권한 설정 수정

📝 :: 권한 설정 수정 #104

Workflow file for this run

name: CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set yml file
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
spring.datasource.url: ${{ secrets.RDS_HOST }}
spring.datasource.username: ${{ secrets.DB_USER }}
spring.datasource.password: ${{ secrets.DB_PW }}
app.jwt.key: ${{ secrets.JWT_KEY }}
app.admin.pw: ${{ secrets.SWAGGER_PW }}
- name: Gradle Wrap
run: gradle wrap
- name: Build with Gradle
run: ./gradlew bootJar
- name: Build Docker Image For Spring
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/checkin:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/checkin:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Docker Run
uses: appleboy/[email protected]
with:
host: ${{ secrets.LINUX_HOST }}
username: ${{ secrets.LINUX_USERNAME }}
password: ${{ secrets.LINUX_PASSWORD }}
script: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker stop checkIn
docker rm checkIn
docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/checkin:latest
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/checkin:latest
docker run -d -p 8080:8080 --name checkIn ${{ secrets.DOCKERHUB_USERNAME }}/checkin:latest