fix(#311): entity 이름 변경: user_tag -> tag_user, brand_tag -> tag_brand… #115
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: CD - PROD | |
| on: | |
| push: | |
| # branches: [ main ] | |
| branches: [ dev ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - uses: gradle/actions/setup-gradle@v3 | |
| - name: Grant execute permission | |
| run: chmod +x gradlew | |
| - name: Build JAR | |
| run: ./gradlew build -x test | |
| - name: Docker Login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build & Push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Docker/Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/realmatch-backend:prod | |
| ${{ secrets.DOCKERHUB_USERNAME }}/realmatch-backend:${{ github.sha }} | |
| - name: Deploy | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.PROD_SERVER_IP }} | |
| username: ubuntu | |
| key: ${{ secrets.PROD_SERVER_SSH_KEY }} | |
| script: | | |
| cd /home/ubuntu/realmatch | |
| docker compose pull | |
| docker compose up -d | |
| echo "Waiting for app to start..." | |
| sleep 10 | |
| if ! docker compose ps | grep "Up"; then | |
| echo "❌ Container is not running" | |
| docker compose logs | |
| exit 1 | |
| fi | |
| echo "🧹 Pruning old docker images..." | |
| docker image prune -a --filter "until=24h" -f |