Update README with deployment resources and fix formatting in ollama.… #16
This file contains 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 .NET application to container app webfrontend | |
on: | |
push: | |
branches: | |
- main | |
env: | |
CONTAINER_APP_CONTAINER_NAME: webfrontend | |
CONTAINER_APP_NAME: webfrontend | |
CONTAINER_APP_RESOURCE_GROUP_NAME: rg-eb11 | |
CONTAINER_REGISTRY_LOGIN_SERVER: acrhxhg3i5mel76m.azurecr.io | |
DOTNET_CORE_VERSION: 8.0.x | |
PROJECT_NAME_FOR_DOCKER: aspireblazoraichatbot.web | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout to the branch | |
uses: actions/checkout@v4 | |
- name: Setup .NET SDK | |
uses: actions/[email protected] | |
with: | |
include-prerelease: True | |
dotnet-version: ${{ env.DOTNET_CORE_VERSION }} | |
- name: Log in to container registry | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }} | |
username: ${{ secrets.acrhxhg3i5mel76m_USERNAME_8B31 }} | |
password: ${{ secrets.acrhxhg3i5mel76m_PASSWORD_8B31 }} | |
- name: Build and push container image to registry | |
run: dotnet publish -c Release -r linux-x64 -p:PublishProfile=DefaultContainer -p:ContainerImageTag=${{ github.sha }} --no-self-contained -p:ContainerRegistry=${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }} -bl | |
- name: Upload binlog for investigation | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: binlog | |
path: msbuild.binlog | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.webfrontend_SPN }} | |
- name: Deploy to containerapp | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: > | |
az config set extension.use_dynamic_install=yes_without_prompt | |
az containerapp registry set --name ${{ env.CONTAINER_APP_NAME }} --resource-group ${{ env.CONTAINER_APP_RESOURCE_GROUP_NAME }} --server ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }} --username ${{ secrets.acrhxhg3i5mel76m_USERNAME_8B31 }} --password ${{ secrets.acrhxhg3i5mel76m_PASSWORD_8B31 }} | |
az containerapp update --name ${{ env.CONTAINER_APP_NAME }} --container-name ${{ env.CONTAINER_APP_CONTAINER_NAME }} --resource-group ${{ env.CONTAINER_APP_RESOURCE_GROUP_NAME }} --image ${{ env.CONTAINER_REGISTRY_LOGIN_SERVER }}/${{ env.PROJECT_NAME_FOR_DOCKER }}:${{ github.sha }} | |
- name: logout | |
run: > | |
az logout |