From aa5dac1e73e67b7fbf1a5ee4f508adcc7af626ae Mon Sep 17 00:00:00 2001 From: Marco van Kimmenade Date: Fri, 27 Sep 2024 16:23:46 +0200 Subject: [PATCH] Build and Deploy Microsoft Teams container (#33) ### Summary & Motivation Update the CalendarAssistant pipeline to automate the build and deployment of the Microsoft Teams application. This enhancement enables streamlined deployment into Azure Container Apps. ### Atomic Changes - Build and Deploy Microsoft Teams container ### Checklist - [x] I have added a Label to the pull-request - [x] I have added tests, and done manual regression tests - [x] I have updated the documentation, if necessary --- .github/workflows/calendar-assistant.yml | 27 +++++++++++++++++++ .../MicrosoftTeams/Dockerfile | 11 ++++++++ .../cluster/calendar-assistant.bicep | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 application/calendar-assistant/MicrosoftTeams/Dockerfile diff --git a/.github/workflows/calendar-assistant.yml b/.github/workflows/calendar-assistant.yml index 8844b0854..216a04aae 100644 --- a/.github/workflows/calendar-assistant.yml +++ b/.github/workflows/calendar-assistant.yml @@ -126,6 +126,19 @@ jobs: name: calendar-assistant-api path: application/calendar-assistant/Api/publish/**/* + - name: Publish MicrosoftTeams build + if: github.ref == 'refs/heads/main' + working-directory: application/calendar-assistant + run: | + dotnet publish ./MicrosoftTeams/CalendarAssistant.MicrosoftTeams.csproj --no-restore --configuration Release --output ./MicrosoftTeams/publish /p:Version=${{ steps.generate_version.outputs.version }} + + - name: Save MicrosoftTeams artifacts + if: github.ref == 'refs/heads/main' + uses: actions/upload-artifact@v4 + with: + name: calendar-assistant-microsoft-teams + path: application/calendar-assistant/MicrosoftTeams/publish/**/* + - name: Publish Worker build if: github.ref == 'refs/heads/main' working-directory: application/calendar-assistant @@ -221,6 +234,20 @@ jobs: docker_context: ./application/calendar-assistant docker_file: ./Api/Dockerfile + microsoft-teams-deploy: + name: Deploy MicrosoftTeams + if: github.ref == 'refs/heads/main' + needs: [build-and-test] + uses: ./.github/workflows/_deploy-container.yml + secrets: inherit + with: + image_name: calendar-assistant-microsoft-teams + version: ${{ needs.build-and-test.outputs.version }} + artifacts_name: calendar-assistant-microsoft-teams + artifacts_path: application/calendar-assistant/MicrosoftTeams/publish + docker_context: ./application/calendar-assistant + docker_file: ./MicrosoftTeams/Dockerfile + workers-deploy: name: Deploy Workers if: github.ref == 'refs/heads/main' diff --git a/application/calendar-assistant/MicrosoftTeams/Dockerfile b/application/calendar-assistant/MicrosoftTeams/Dockerfile new file mode 100644 index 000000000..43276cf90 --- /dev/null +++ b/application/calendar-assistant/MicrosoftTeams/Dockerfile @@ -0,0 +1,11 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine + +RUN apk add --no-cache icu-libs +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false + +WORKDIR /app +COPY ./MicrosoftTeams/publish . + +USER app + +ENTRYPOINT ["dotnet", "Moment42.CalendarAssistant.MicrosoftTeams.dll"] diff --git a/cloud-infrastructure/cluster/calendar-assistant.bicep b/cloud-infrastructure/cluster/calendar-assistant.bicep index 318ff6729..a5eeb095c 100644 --- a/cloud-infrastructure/cluster/calendar-assistant.bicep +++ b/cloud-infrastructure/cluster/calendar-assistant.bicep @@ -178,7 +178,7 @@ module calendarAssistantMicrosoftTeams '../modules/container-app.bicep' = { name: '${resourceGroupName}-calendar-assistant-microsoft-teams-container-app' scope: clusterResourceGroup params: { - name: 'calendar-assistant-microsoft-teams' + name: 'calendar-assistant-ms-teams' location: location tags: tags resourceGroupName: resourceGroupName