feat: add facial recognition thresholds to configuration and update u… #38
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: Docker Build and Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| main: ${{ steps.filter.outputs.main }} | |
| inference: ${{ steps.filter.outputs.inference }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: dorny/paths-filter@v4 | |
| id: filter | |
| with: | |
| filters: | | |
| main: | |
| - 'main_api/**' | |
| inference: | |
| - 'inference_api/**' | |
| build-and-push-main-api: | |
| needs: detect-changes | |
| if: ${{ needs.detect-changes.outputs.main == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata for main_api | |
| id: meta_main | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/main_api | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha,format=short | |
| type=semver,pattern={{version}} | |
| - name: Build and push main_api | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./main_api | |
| file: ./main_api/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta_main.outputs.tags }} | |
| labels: ${{ steps.meta_main.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy-main-api: | |
| needs: build-and-push-main-api | |
| runs-on: [self-hosted, eventsnap] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Copy Configuration Files | |
| run: | | |
| cp main_api/docker-compose.yml /home/eventsnap/docker-compose.yml | |
| mkdir -p /home/eventsnap/config | |
| cp -rf config/* /home/eventsnap/config/ | |
| - name: Deploy main_api | |
| run: sudo /usr/local/bin/eventsnap | |
| build-and-push-inference-cpu: | |
| needs: detect-changes | |
| if: ${{ needs.detect-changes.outputs.inference == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata for inference_api (CPU) | |
| id: meta_cpu | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/inference_api | |
| tags: | | |
| type=raw,value=cpu-latest,enable={{is_default_branch}} | |
| type=sha,format=short,prefix=cpu- | |
| type=semver,pattern=cpu-{{version}} | |
| - name: Build and push inference_api (CPU) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./inference_api | |
| file: ./inference_api/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta_cpu.outputs.tags }} | |
| labels: ${{ steps.meta_cpu.outputs.labels }} | |
| cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/inference_api:buildcache-cpu | |
| cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/inference_api:buildcache-cpu,mode=max | |
| build-and-push-inference-gpu: | |
| needs: detect-changes | |
| if: ${{ needs.detect-changes.outputs.inference == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata for inference_api (GPU) | |
| id: meta_gpu | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/inference_api | |
| tags: | | |
| type=raw,value=gpu-latest,enable={{is_default_branch}} | |
| type=sha,format=short,prefix=gpu- | |
| type=semver,pattern=gpu-{{version}} | |
| - name: Build and push inference_api (GPU) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./inference_api | |
| file: ./inference_api/Dockerfile.gpu | |
| push: true | |
| tags: ${{ steps.meta_gpu.outputs.tags }} | |
| labels: ${{ steps.meta_gpu.outputs.labels }} | |
| cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/inference_api:buildcache-gpu | |
| cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/inference_api:buildcache-gpu,mode=max | |
| deploy-inference-api: | |
| needs: build-and-push-inference-gpu | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to Google Cloud VM | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.GCP_VM_IP }} | |
| username: github-actions | |
| key: ${{ secrets.GCP_SSH_PRIVATE_KEY }} | |
| script: | | |
| cd /app | |
| sudo docker compose pull | |
| sudo docker compose up -d |