Skip to content

Update .gitignore to include Node.js dependencies #26

Update .gitignore to include Node.js dependencies

Update .gitignore to include Node.js dependencies #26

name: Build and Deploy to Azure
on:
push:
branches:
- master
jobs:
build-and-deploy:
name: Build and Deploy to Azure Container Apps
runs-on: ubuntu-latest
permissions:
id-token: write # Require write permission to Fetch an OIDC token.
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Log in to Azure
- name: Log in to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUB_ID }}
enable-AzPSSession: true
# Build the Docker image
- name: Build Docker image
run: |
docker build -t ghcr.io/${{ secrets.GHCR_USERNAME }}/weather-py:latest .
# Push the Docker image to GitHub Container Registry
- name: Push Docker image to ACR
run: |
echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
docker push ghcr.io/${{ secrets.GHCR_USERNAME }}/weather-py:latest
# Deploy the container to Azure Container Apps
- name: Deploy to Azure Container Apps
run: |
az containerapp update \
--name ${{ secrets.CONTAINER_APP_NAME }} \
--resource-group ${{ secrets.RESOURCE_GROUP }} \
--image ghcr.io/${{ secrets.GHCR_USERNAME }}/weather-py:latest \
--set-env-vars \
"AZURE_OPENAI_API_KEY=${{secrets.AZURE_OPENAI_API_KEY}}" \
"AZURE_OPENAI_ENDPOINT=${{ secrets.AZURE_OPENAI_ENDPOINT }}" \
"AZURE_OPENAI_DEPLOYMENT=${{ secrets.AZURE_OPENAI_DEPLOYMENT }}" \
"AZURE_OPENAI_API_VERSION=2024-10-21"