Skip to content

Commit 2524bd0

Browse files
author
Mehdi Necibi
committed
added azure github action
1 parent 44ba3f0 commit 2524bd0

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

‎.github/workflows/deploy_azure.yml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This workflow build and push a Docker container to Google Artifact Registry and deploy it on Cloud Run when a commit is pushed to the "main" branch
2+
3+
name: Build and Deploy to Azure Registry
4+
5+
on: push
6+
env:
7+
AZURE_WEBAPP_NAME: threatshield # set this to your application's name
8+
9+
jobs:
10+
build-and-deploy-to-dev:
11+
runs-on: ubuntu-latest
12+
environment: dev
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Azure authentication
16+
uses: azure/login@v1
17+
with:
18+
creds: ${{ secrets.AZURE_CREDENTIALS }}
19+
- name: "Build and push image"
20+
uses: azure/docker-login@v1
21+
with:
22+
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
23+
username: ${{ secrets.REGISTRY_USERNAME }}
24+
password: ${{ secrets.REGISTRY_PASSWORD }}
25+
- run: |
26+
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/threatshield:${{ github.sha }}
27+
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/threatshield:${{ github.sha }}
28+
29+
- name: "Deploy to Azure Container Instances"
30+
uses: "azure/aci-deploy@v1"
31+
with:
32+
cpu: 1
33+
memory: 1
34+
resource-group: ${{ secrets.RESOURCE_GROUP }}
35+
registry-login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
36+
registry-username: ${{ secrets.REGISTRY_USERNAME }}
37+
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
38+
name: ${{ env.AZURE_WEBAPP_NAME }}
39+
dns-name-label: threatshield-demo
40+
image: ${{ secrets.REGISTRY_LOGIN_SERVER }}/threatshield:${{ github.sha }}
41+
location: ${{ secrets.CONTAINER_INSTANCES_LOCATION }}

0 commit comments

Comments
 (0)