[Fix] - processorMetrics 관련 에러 해결 #4
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 API PROD | |
| on: | |
| pull_request: | |
| branches: [ develop ] | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| api_changed: ${{ steps.filter.outputs.api }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| base: develop | |
| filters: | | |
| api: | |
| - 'api/**' | |
| build-api: | |
| needs: detect-changes | |
| # if: needs.detect-changes.outputs.api_changed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'corretto' | |
| java-version: '17' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Grant execute permission for run-test-mysql-redis.sh | |
| run: chmod +x run-test-mysql-redis.sh | |
| working-directory: ./domain | |
| - name: Run test mysql redis script | |
| run: ./run-test-mysql-redis.sh | |
| working-directory: ./domain | |
| - name: Test & Build api only | |
| run: ./gradlew :api:build | |
| - name: Sign in Dockerhub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build the Docker image | |
| run: docker build -f ./Dockerfile --platform linux/arm64 --no-cache -t samhap/kokomen-notification-api:prod . | |
| working-directory: ./api | |
| - name: Push the Docker Image to Dockerhub | |
| run: docker push samhap/kokomen-notification-api:prod | |
| working-directory: ./api | |
| deploy-api: | |
| needs: build-api | |
| runs-on: [ self-hosted, prod-notification ] | |
| strategy: | |
| matrix: | |
| runner: [ prod-notification-a, prod-notification-b ] | |
| steps: | |
| - name: Stop existing container | |
| run: sudo docker rm -f kokomen-notification-api || true | |
| - name: Remove old API Docker image | |
| run: | | |
| if sudo docker images samhap/kokomen-notification-api:prod -q | grep -q .; then | |
| sudo docker rmi -f samhap/kokomen-notification-api:prod || true | |
| fi | |
| - name: pull docker compose yaml files | |
| working-directory: /home/ubuntu | |
| run: | | |
| [ -d kokomen-notification ] || git clone --filter=blob:none --no-checkout https://github.com/samhap-soft/kokomen-notification.git | |
| cd kokomen-notification | |
| git sparse-checkout init --cone | |
| git fetch origin feature/#16 | |
| git checkout feature/#16 | |
| git sparse-checkout set docker/prod | |
| git pull origin feature/#16 | |
| - name: Docker Image pull | |
| run: sudo docker pull samhap/kokomen-notification-api:prod | |
| - name: Docker run | |
| working-directory: /home/ubuntu | |
| run: | | |
| export HOSTNAME=$(hostname) | |
| cd kokomen-notification/docker/prod | |
| sudo -E docker compose -f docker-compose-prod.yml up -d kokomen-notification-api |