Skip to content

Commit

Permalink
Update container_apps_chat_cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsPilgaard committed Oct 16, 2023
1 parent 11d53ab commit 32ea2c3
Showing 1 changed file with 44 additions and 7 deletions.
51 changes: 44 additions & 7 deletions .github/workflows/container_apps_chat_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 32ea2c3

Please sign in to comment.