fix: jwt authentication filter 에러 수정 #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI / CD | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
# Spring Boot 애플리케이션을 빌드하여 도커허브에 푸시 | |
application-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
# 지정한 저장소(현재 REPO)에서 코드를 워크플로우 환경으로 가져오도록 하는 github action | |
steps: | |
- uses: actions/checkout@v4 | |
# 1. Java 17 세팅 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# 2. application-private.yml 설정 | |
- name: Set application-private.yml file | |
run: | | |
# application-private.yml 파일 생성 | |
cd ./src/main/resources | |
touch ./application-private.yml | |
# GitHub-Actions 에서 설정한 값을 application-private.yml 파일에 쓰기 | |
echo "${{ secrets.APPLICATION_PRIVATE_YML }}" >> ./application-private.yml | |
shell: bash | |
# 3. gradle을 통해 소스를 빌드. | |
- name: Build with Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew clean build | |
# 4. Docker image 업로드 | |
# { username/repository } 로 빌드 & . 이 의미하는 것은 Dockerfile의 경로를 의미함. | |
- name: Docker build & push to docker repo | |
run: | | |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t ${{ secrets.DOCKER_USER }}/wssrs . | |
docker push ${{ secrets.DOCKER_USER }}/wssrs | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
key: ${{ secrets.EC2_PRIVATE_KEY }} # pem key | |
host: ${{ secrets.EC2_HOST }} # ec2 ip | |
username: ${{ secrets.EC2_USER }} # ec2에서 whoami 명령어로 확인 | |
script: | | |
sudo docker rm -f $(sudo docker ps -qa) | |
sudo docker pull ryu7844/wssrs | |
sudo docker system prune -f | |
sudo docker run -d --rm -p 8080:8080 ryu7844/wssrs |