-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 2.16 KB
/
deploytoContainerWebApp-2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Github Action'
uses: actions/checkout@master
- name: 'Login via Azure CLI'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create ACR
id: create-acr
run: |
az acr create -n knovidGithub -g knovid-rg --location "UAE North" --sku Standard --admin-enabled
echo "::set-output name=acr_username::`az acr credential show -n knovidGithub --query username | xargs`"
echo "::set-output name=acr_password::`az acr credential show -n knovidGithub --query passwords[0].value | xargs`"
echo "::add-mask::`az acr credential show -n knovidGithub --query passwords[0].value | xargs`"
- uses: azure/docker-login@v1
with:
login-server: knovidgithub.azurecr.io
username: ${{ steps.create-acr.outputs.acr_username }}
password: ${{ steps.create-acr.outputs.acr_password }}
- name: Build and push image to ACR
id: build-image
run: |
docker build "$GITHUB_WORKSPACE/" -f "Dockerfile" -t knovidgithub.azurecr.io/knovid-img:${{ github.sha }}
docker push knovidgithub.azurecr.io/knovid-img:${{ github.sha }}
- name: Set Web App ACR authentication
uses: Azure/appservice-settings@v1
with:
app-name: knovid
app-settings-json: |
[
{
"name": "DOCKER_REGISTRY_SERVER_URL",
"value": "knovidgithub.azurecr.io",
"slotSetting": false
},
{
"name": "DOCKER_REGISTRY_SERVER_USERNAME",
"value": "${{ steps.create-acr.outputs.acr_username }}",
"slotSetting": false
},
{
"name": "DOCKER_REGISTRY_SERVER_PASSWORD",
"value": "${{ steps.create-acr.outputs.acr_password }}",
"slotSetting": false
}
]
- uses: azure/webapps-deploy@v2
with:
app-name: knovid
images: knovidgithub.azurecr.io/knovid-img:${{ github.sha }}