Update environment configuration and dependencies for Mistral integra… #1
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: Build and Deploy to Docker Hub | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| APP_IMAGE: notebot-lm-app | |
| WORKER_IMAGE: notebot-lm-worker | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract Docker metadata for app | |
| id: meta-app | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_IMAGE }} | |
| tags: | | |
| type=raw,value=latest | |
| type=sha,prefix= | |
| - name: Build and push app image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: app | |
| push: true | |
| tags: ${{ steps.meta-app.outputs.tags }} | |
| labels: ${{ steps.meta-app.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| NEXT_PUBLIC_SUPABASE_URL=${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} | |
| - name: Extract Docker metadata for worker | |
| id: meta-worker | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.WORKER_IMAGE }} | |
| tags: | | |
| type=raw,value=latest | |
| type=sha,prefix= | |
| - name: Build and push worker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: worker | |
| push: true | |
| tags: ${{ steps.meta-worker.outputs.tags }} | |
| labels: ${{ steps.meta-worker.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy: | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Deploy to EC2 | |
| uses: appleboy/ssh-action@v1.2.0 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| set -e | |
| cd ~/NoteBotLM | |
| git pull origin main | |
| if [ ! -f .env ]; then | |
| echo "ERROR: ~/NoteBotLM/.env missing. Copy .env.production.example to .env on EC2 first." | |
| exit 1 | |
| fi | |
| docker compose -f docker-compose.prod.yml pull | |
| docker compose -f docker-compose.prod.yml up -d --remove-orphans | |
| docker image prune -f |