| 1 | name: Docker |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main] |
| 6 | |
| 7 | jobs: |
| 8 | build-backend: |
| 9 | runs-on: ubuntu-latest |
| 10 | |
| 11 | steps: |
| 12 | - name: Check out code |
| 13 | uses: actions/checkout@v2 |
| 14 | |
| 15 | - name: Set up Docker Buildx |
| 16 | uses: docker/setup-buildx-action@v1 |
| 17 | |
| 18 | - name: Login to GitHub Container Registry |
| 19 | uses: docker/login-action@v1 |
| 20 | with: |
| 21 | registry: ghcr.io |
| 22 | username: ${{ secrets.REPO_OWNER }} |
| 23 | password: ${{ secrets.REPO_TOKEN }} |
| 24 | |
| 25 | - name: Build and push Docker image |
| 26 | uses: docker/build-push-action@v2 |
| 27 | with: |
| 28 | context: ./backend |
| 29 | push: true |
| 30 | tags: ghcr.io/socfortress/copilot-backend:latest |
| 31 | build-args: | |
| 32 | COPILOT_API_KEY=${{ secrets.COPILOT_API_KEY }} |
| 33 | |
| 34 | - name: Notify Discord |
| 35 | uses: appleboy/discord-action@v1.0.0 |
| 36 | with: |
| 37 | webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} |
| 38 | webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} |
| 39 | message: "Docker image for backend has been updated." |
| 40 | |
| 41 | build-frontend: |
| 42 | runs-on: ubuntu-latest |
| 43 | |
| 44 | steps: |
| 45 | - name: Check out code |
| 46 | uses: actions/checkout@v2 |
| 47 | |
| 48 | - name: Set up Docker Buildx |
| 49 | uses: docker/setup-buildx-action@v1 |
| 50 | |
| 51 | - name: Login to GitHub Container Registry |
| 52 | uses: docker/login-action@v1 |
| 53 | with: |
| 54 | registry: ghcr.io |
| 55 | username: ${{ secrets.REPO_OWNER }} |
| 56 | password: ${{ secrets.REPO_TOKEN }} |
| 57 | |
| 58 | - name: Build and push Docker image |
| 59 | uses: docker/build-push-action@v2 |
| 60 | with: |
| 61 | context: ./frontend |
| 62 | push: true |
| 63 | tags: ghcr.io/socfortress/copilot-frontend:latest |
| 64 | |
| 65 | - name: Notify Discord |
| 66 | uses: appleboy/discord-action@v1.0.0 |
| 67 | with: |
| 68 | webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} |
| 69 | webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} |
| 70 | message: "Docker image for frontend has been updated." |
| 71 | |
| 72 | build-customer-portal: |
| 73 | runs-on: ubuntu-latest |
| 74 | |
| 75 | steps: |
| 76 | - name: Check out code |
| 77 | uses: actions/checkout@v2 |
| 78 | |
| 79 | - name: Set up Docker Buildx |
| 80 | uses: docker/setup-buildx-action@v1 |
| 81 | |
| 82 | - name: Login to GitHub Container Registry |
| 83 | uses: docker/login-action@v1 |
| 84 | with: |
| 85 | registry: ghcr.io |
| 86 | username: ${{ secrets.REPO_OWNER }} |
| 87 | password: ${{ secrets.REPO_TOKEN }} |
| 88 | |
| 89 | - name: Build and push Docker image |
| 90 | uses: docker/build-push-action@v2 |
| 91 | with: |
| 92 | context: ./customer-portal |
| 93 | push: true |
| 94 | tags: ghcr.io/socfortress/copilot-customer-portal:latest |
| 95 | |
| 96 | - name: Notify Discord |
| 97 | uses: appleboy/discord-action@v1.0.0 |
| 98 | with: |
| 99 | webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} |
| 100 | webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} |
| 101 | message: "Docker image for customer portal has been updated." |