Skip to content

Commit c119fbc

Browse files
authored
Merge pull request #292358 from jeffwmartinez/jefmarti-win-gha-3
adding windows zone pivot without includes
2 parents 06a4945 + 6f679a2 commit c119fbc

File tree

2 files changed

+188
-0
lines changed

2 files changed

+188
-0
lines changed

articles/app-service/deploy-container-github-action.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ms.custom: github-actions-azure, devx-track-azurecli, linux-related-content
88
ms.devlang: azurecli
99
author: cephalin
1010
ms.author: cephalin
11+
zone_pivot_groups: app-service-containers-github-actions
1112
---
1213

1314
# Deploy a custom container to App Service using GitHub Actions
@@ -182,6 +183,8 @@ Define secrets to use with the Docker Login action. The example in this document
182183

183184
## Build the Container image
184185

186+
::: zone pivot="github-actions-containers-linux"
187+
185188
The following example show part of the workflow that builds a Node.js Docker image. Use [Docker Login](https://github.com/azure/docker-login) to log into a private container registry. This example uses Azure Container Registry but the same action works for other registries.
186189

187190

@@ -234,6 +237,59 @@ jobs:
234237
docker push mycontainer.azurecr.io/myapp:${{ github.sha }}
235238
```
236239

240+
::: zone-end
241+
242+
::: zone pivot="github-actions-containers-windows"
243+
244+
The following example shows part of the workflow that builds a Windows Docker image. Use [Docker Login](https://github.com/azure/docker-login) to log into a private container registry. This example uses Azure Container Registry but the same action works for other registries.
245+
246+
247+
```yaml
248+
name: Windows Container Workflow
249+
on: [push]
250+
jobs:
251+
build:
252+
runs-on: windows-latest
253+
steps:
254+
- uses: actions/checkout@v2
255+
- uses: azure/docker-login@v1
256+
with:
257+
login-server: mycontainer.azurecr.io
258+
username: ${{ secrets.REGISTRY_USERNAME }}
259+
password: ${{ secrets.REGISTRY_PASSWORD }}
260+
- run: |
261+
docker build . -t mycontainer.azurecr.io/myapp:${{ github.sha }}
262+
docker push mycontainer.azurecr.io/myapp:${{ github.sha }}
263+
```
264+
265+
You can also use [Docker sign-in](https://github.com/azure/docker-login) to log into multiple container registries at the same time. This example includes two new GitHub secrets for authentication with docker.io. The example assumes that there's a Dockerfile at the root level of the registry.
266+
267+
```yml
268+
name: Windows Container Workflow
269+
on: [push]
270+
jobs:
271+
build:
272+
runs-on: windows-latest
273+
steps:
274+
- uses: actions/checkout@v2
275+
- uses: azure/docker-login@v1
276+
with:
277+
login-server: mycontainer.azurecr.io
278+
username: ${{ secrets.REGISTRY_USERNAME }}
279+
password: ${{ secrets.REGISTRY_PASSWORD }}
280+
- uses: azure/docker-login@v1
281+
with:
282+
login-server: index.docker.io
283+
username: ${{ secrets.DOCKERIO_USERNAME }}
284+
password: ${{ secrets.DOCKERIO_PASSWORD }}
285+
- run: |
286+
docker build . -t mycontainer.azurecr.io/myapp:${{ github.sha }}
287+
docker push mycontainer.azurecr.io/myapp:${{ github.sha }}
288+
```
289+
290+
::: zone-end
291+
292+
237293
## Deploy to an App Service container
238294

239295
To deploy your image to a custom container in App Service, use the `azure/webapps-deploy@v2` action. This action has seven parameters:
@@ -248,8 +304,11 @@ To deploy your image to a custom container in App Service, use the `azure/webapp
248304
| **configuration-file** | (Optional) Applies to Web App Containers only: Path of the Docker-Compose file. Should be a fully qualified path or relative to the default working directory. Required for multi-container apps. |
249305
| **startup-command** | (Optional) Enter the start-up command. For ex. dotnet run or dotnet filename.dll |
250306

307+
::: zone pivot="github-actions-containers-linux"
308+
251309
# [Publish profile](#tab/publish-profile)
252310

311+
253312
```yaml
254313
name: Linux Container Node Workflow
255314
@@ -362,6 +421,126 @@ jobs:
362421
az logout
363422
```
364423

424+
::: zone-end
425+
426+
::: zone pivot="github-actions-containers-windows"
427+
428+
# [Publish profile](#tab/publish-profile)
429+
430+
```yaml
431+
name: Windows_Container_Workflow
432+
433+
on: [push]
434+
435+
jobs:
436+
build:
437+
runs-on: windows-latest
438+
439+
steps:
440+
- uses: actions/checkout@v2
441+
442+
- uses: azure/docker-login@v1
443+
with:
444+
login-server: mycontainer.azurecr.io
445+
username: ${{ secrets.REGISTRY_USERNAME }}
446+
password: ${{ secrets.REGISTRY_PASSWORD }}
447+
448+
- run: |
449+
docker build . -t mycontainer.azurecr.io/myapp:${{ github.sha }}
450+
docker push mycontainer.azurecr.io/myapp:${{ github.sha }}
451+
452+
- uses: azure/webapps-deploy@v2
453+
with:
454+
app-name: 'myapp'
455+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
456+
images: 'mycontainer.azurecr.io/myapp:${{ github.sha }}'
457+
```
458+
459+
# [Service principal](#tab/service-principal)
460+
461+
```yaml
462+
on: [push]
463+
464+
name: Windows_Container_Workflow
465+
466+
jobs:
467+
build-and-deploy:
468+
runs-on: windows-latest
469+
steps:
470+
# checkout the repo
471+
- name: 'Checkout GitHub Action'
472+
uses: actions/checkout@main
473+
474+
- name: 'Sign in via Azure CLI'
475+
uses: azure/login@v1
476+
with:
477+
creds: ${{ secrets.AZURE_CREDENTIALS }}
478+
479+
- uses: azure/docker-login@v1
480+
with:
481+
login-server: mycontainer.azurecr.io
482+
username: ${{ secrets.REGISTRY_USERNAME }}
483+
password: ${{ secrets.REGISTRY_PASSWORD }}
484+
- run: |
485+
docker build . -t mycontainer.azurecr.io/myapp:${{ github.sha }}
486+
docker push mycontainer.azurecr.io/myapp:${{ github.sha }}
487+
488+
- uses: azure/webapps-deploy@v2
489+
with:
490+
app-name: 'myapp'
491+
images: 'mycontainer.azurecr.io/myapp:${{ github.sha }}'
492+
493+
- name: Azure logout
494+
run: |
495+
az logout
496+
```
497+
498+
# [OpenID Connect](#tab/openid)
499+
500+
```yaml
501+
on: [push]
502+
name: Windows_Container_Workflow
503+
504+
permissions:
505+
id-token: write
506+
contents: read
507+
508+
jobs:
509+
build-and-deploy:
510+
runs-on: windows-latest
511+
steps:
512+
# checkout the repo
513+
- name: 'Checkout GitHub Action'
514+
uses: actions/checkout@main
515+
516+
- name: 'Sign in via Azure CLI'
517+
uses: azure/login@v1
518+
with:
519+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
520+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
521+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
522+
523+
- uses: azure/docker-login@v1
524+
with:
525+
login-server: mycontainer.azurecr.io
526+
username: ${{ secrets.REGISTRY_USERNAME }}
527+
password: ${{ secrets.REGISTRY_PASSWORD }}
528+
- run: |
529+
docker build . -t mycontainer.azurecr.io/myapp:${{ github.sha }}
530+
docker push mycontainer.azurecr.io/myapp:${{ github.sha }}
531+
532+
- uses: azure/webapps-deploy@v2
533+
with:
534+
app-name: 'myapp'
535+
images: 'mycontainer.azurecr.io/myapp:${{ github.sha }}'
536+
537+
- name: Azure logout
538+
run: |
539+
az logout
540+
```
541+
542+
::: zone-end
543+
365544
---
366545

367546
## Next steps

articles/zone-pivot-groups.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,15 @@ groups:
783783
title: Java
784784
- id: openai-node
785785
title: Node
786+
# Owner: jefmarti
787+
- id: app-service-containers-github-actions
788+
title: App Service GitHub actions
789+
prompt: Choose a platform
790+
pivots:
791+
- id: github-actions-containers-linux
792+
title: Linux
793+
- id: github-actions-containers-windows
794+
title: Windows
786795
# Owner: msangapu
787796
- id: app-spaces-component-types
788797
title: App Spaces components

0 commit comments

Comments
 (0)