From 32ea2c307efcaabc45372997096ae6f9bef56715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Pilgaard=20Gr=C3=B8ndahl?= Date: Mon, 16 Oct 2023 19:18:34 +0200 Subject: [PATCH] Update container_apps_chat_cd.yml --- .github/workflows/container_apps_chat_cd.yml | 51 +++++++++++++++++--- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/.github/workflows/container_apps_chat_cd.yml b/.github/workflows/container_apps_chat_cd.yml index 66c6e3b4..970b3623 100644 --- a/.github/workflows/container_apps_chat_cd.yml +++ b/.github/workflows/container_apps_chat_cd.yml @@ -42,24 +42,61 @@ jobs: (needs.test.result == 'success' || needs.test.result == 'skipped') needs: [test] runs-on: ubuntu-latest + env: + DOCKER_IMAGE_NAME: chat steps: - name: Checkout code uses: actions/checkout@v4 + # Apply tags and labels based on GitHub Actions events and Git metadata + - name: Apply Docker Image tags & labels + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }} + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=ref,event=pr + type=match,pattern=v(.*),group=1 + type=match,pattern=v(\d.\d),group=1 + type=match,pattern=v(\d),group=1 + type=sha + type=raw,value=latest,enable={{is_default_branch}} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + context: . + file: ./src/container_apps/Jordnaer.Chat/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Azure Login uses: azure/login@v1 with: creds: ${{ secrets.CHAT_AZURE_CREDENTIALS }} - + - name: Deploy image to Azure Container Apps uses: azure/container-apps-deploy-action@v1 with: - appSourcePath: . - registryUrl: ghcr.io - registryUsername: ${{ github.repository_owner }} - registryPassword: ${{ secrets.GITHUB_TOKEN }} containerAppName: chat resourceGroup: Jordnaer - imageToBuild: ghcr.io/nielspilgaard/chat:${{ github.sha }} - dockerfilePath: ./src/container_apps/Jordnaer.Chat Dockerfile + imageToDeploy: ghcr.io/nielspilgaard/chat:${{ github.sha }} \ No newline at end of file