fix: Optional get 수정 #48
This file contains hidden or 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: Java CI with Gradle | |
| on: | |
| push: | |
| branches: [ "develop" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| ## 원격 서버에서 docker-compose 실행 | |
| - name: Build and Run Docker on Server | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| key: ${{ secrets.PRIVATE_KEY }} | |
| port: ${{ secrets.PORT }} | |
| script: | | |
| # 최신 코드 가져오기 | |
| cd /home/ubuntu/server | |
| git pull origin develop | |
| # application.properties 새로 생성 | |
| touch ./src/main/resources/application.properties | |
| echo "${{ secrets.APPLICATION }}" | sudo tee ./src/main/resources/application.properties > /dev/null | |
| # 🔹 JAR 빌드 (서버에서 실행) | |
| ./gradlew bootJar | |
| # 파일명 변경 | |
| mv /home/ubuntu/server/build/libs/SoundLink_Java-0.0.1-SNAPSHOT.jar /home/ubuntu/docker/soundlink.jar | |
| cd /home/ubuntu/docker | |
| # 기존 Spring 컨테이너 중지 및 제거 | |
| sudo docker-compose stop spring | |
| sudo docker-compose rm -f spring | |
| # Spring 컨테이너만 다시 빌드 & 실행 | |
| docker-compose up --build -d spring | |
| sudo docker-compose up -d spring | |
| # 불필요한 이미지 정리 | |
| sudo docker image prune -f |