✨ feat: 스레드 풀 관련 개선 및 자잘한 이슈 수정 #16
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: CI/CD | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set Java JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Run build | |
| run: ./gradlew clean build -x test -i --no-daemon -Dspring.profiles.active=prod | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build Docker image | |
| run: docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} . | |
| - name: Push Docker image | |
| run: docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} | |
| cd: | |
| runs-on: ubuntu-latest | |
| name: Deploy to EC2 | |
| needs: ci | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Deploy to EC2 | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.AWS_EC2_IP }} | |
| username: ${{ secrets.AWS_EC2_USERNAME }} | |
| key: ${{ secrets.AWS_EC2_KEY }} | |
| port: ${{ secrets.AWS_EC2_PORT }} | |
| script: | | |
| cd /home/ubuntu | |
| APP_NAME=${{ secrets.DOCKER_REPO }} | |
| IMAGE=${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} | |
| docker pull "$IMAGE" | |
| if [ "$(docker ps -aq -f name=$APP_NAME)" ]; then | |
| echo "Stopping existing container: $APP_NAME" | |
| docker stop "$APP_NAME" || true | |
| docker rm "$APP_NAME" || true | |
| fi | |
| docker run -d \ | |
| --name "$APP_NAME" \ | |
| -e SPRING_PROFILES_ACTIVE=prod \ | |
| -e "JAVA_TOOL_OPTIONS=-Duser.timezone=Asia/Seoul" \ | |
| -e "MYSQL_URL=${{ secrets.MYSQL_URL }}" \ | |
| -e "MYSQL_USERNAME=${{ secrets.MYSQL_USERNAME }}" \ | |
| -e "MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }}" \ | |
| -e "JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}" \ | |
| -e "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" \ | |
| -e "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" \ | |
| -e "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" \ | |
| -e "KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}" \ | |
| -e "NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}" \ | |
| -e "NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}" \ | |
| -e "BACKEND_URL=${{ secrets.BACKEND_URL }}" \ | |
| -e "FRONTEND_URL=${{ secrets.FRONTEND_URL }}" \ | |
| -e "AI_SERVER_URL=${{ secrets.AI_SERVER_URL }}" \ | |
| -p "8080:8080" \ | |
| "$IMAGE" | |
| docker image prune -f |