You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-instances/container-instances-github-action.md
+34-31Lines changed: 34 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,27 @@
1
1
---
2
-
title: Trigger container group by GitHub action
2
+
title: Deploy container instance by GitHub action
3
3
description: Configure a GitHub action that automates steps to build, push, and deploy a container image to Azure Container Instances
4
4
ms.topic: article
5
-
ms.date: 03/17/2020
5
+
ms.date: 03/18/2020
6
6
ms.custom:
7
7
---
8
8
9
-
# Configure a GitHub action to create a container group
9
+
# Configure a GitHub action to create a container instance
10
10
11
11
[GitHub Actions](https://help.github.com/actions/getting-started-with-github-actions/about-github-actions) is a suite of features in GitHub to automate your software development workflows in the same place you store code and collaborate on pull requests and issues.
12
12
13
-
Use GitHub actions to automate deployment of a container image to Azure Container Instances. This article shows you how to set up a workflow in a GitHub repo triggered by push of a code commit that performs the following actions:
13
+
Use the [Deploy to Azure Container Instances](https://github.com/azure/aci-deploy) GitHub action to automate deployment of a container to Azure Container Instances. The action allows you to set properties for a container instance similar to those in the [az container create][az-container-create] command.
14
+
15
+
This article shows how to set up a workflow in a GitHub repo that performs the following actions:
14
16
15
17
* Build an image from a Dockerfile
16
18
* Push the image to an Azure container registry
17
-
* Deploy the container image to Azure Container Instances
19
+
* Deploy the container image to an Azure container instance
18
20
19
-
This article shows two methods to set up the workflow:
21
+
This article shows two ways to set up the workflow:
20
22
21
-
* Configure a workflow in a GitHub repo that uses the [Deploy to Azure Container Instances](https://github.com/azure/aci-deploy-action) action
22
-
* Use the `az container app up` command in the [Deploy to Azure](https://github.com/Azure/deploy-to-azure-cli-extension) extension in the Azure CLI. This command streamlines creation of the GitHub workflow and deployment steps
23
+
* Configure a workflow yourself in a GitHub repo using the Deploy to Azure Container Instances action and other actions.
24
+
* Use the `az container app up` command in the [Deploy to Azure](https://github.com/Azure/deploy-to-azure-cli-extension) extension in the Azure CLI. This command streamlines creation of the GitHub workflow and deployment steps.
23
25
24
26
> [!IMPORTANT]
25
27
> The GitHub action for Azure Container Instances is currently in preview. Previews are made available to you on the condition that you agree to the [supplemental terms of use][terms-of-use]. Some aspects of this feature may change prior to general availability (GA).
@@ -30,13 +32,11 @@ This article shows two methods to set up the workflow:
30
32
***Azure CLI** - You can use the Azure Cloud Shell or a local installation of the Azure CLI to complete the Azure CLI steps. If you need to install or upgrade, see [Install Azure CLI][azure-cli-install].
31
33
***Azure container registry** - If you don't have one, create an Azure container registry in the Basic tier using the [Azure CLI](../container-registry/container-registry-get-started-azure-cli.md), [Azure portal](../container-registry/container-registry-get-started-portal.md), or other methods. Take note of the resource group used for the deployment, which is used for the GitHub workflow.
32
34
33
-
## Workflow setup
34
-
35
-
### Fork sample repo
35
+
## Set up repo
36
36
37
37
* For the examples in this article, use GitHub to fork the following repository: https://github.com/Azure-Samples/acr-build-helloworld-node
38
38
39
-
This repo contains a Dockerfile to create a container image of a small web app.
39
+
This repo contains a Dockerfile and source files to create a container image of a small web app.
40
40
41
41

42
42
@@ -86,7 +86,7 @@ Save the JSON output because it is used in a later step. Also, take note of the
86
86
87
87
### Update service principal for registry authentication
88
88
89
-
Update the Azure service principal credentials to allow push and pull permissions on your container registry. This step allows you the GitHub workflow to us the service principal to [authenticate with your container registry](../container-registry/container-registry-auth-service-principal.md).
89
+
Update the Azure service principal credentials to allow push and pull permissions on your container registry. This step allows the GitHub workflow to use the service principal to [authenticate with your container registry](../container-registry/container-registry-auth-service-principal.md).
90
90
91
91
Get the resource ID of your container registry. Substitute the name of your registry in the following [az acr show][az-acr-show] command:
After you commit the workflow file, the workflow is triggered. To review workflow progress, navigate to **Actions** > **Workflows**. See [Managing a workflow run](https://help.github.com/actions/configuring-and-managing-workflows/managing-a-workflow-run) for information about viewing the status and results of each step in your workflow.
171
+
After you commit the workflow file, the workflow is triggered. To review workflow progress, navigate to **Actions** > **Workflows**.
See [Managing a workflow run](https://help.github.com/actions/configuring-and-managing-workflows/managing-a-workflow-run) for information about viewing the status and results of each step in your workflow.
176
+
175
177
When the workflow completes, get information about the container instance named *aci-sampleapp* by running the [az container show][az-container-show] command. Substitute the name of your resource group:
176
178
177
179
```azurecli
@@ -196,30 +198,28 @@ After the instance is provisioned, navigate to the container's FQDN in your brow
196
198
197
199
## Use Deploy to Azure extension
198
200
199
-
Alternatively, use the [Deploy to Azure extension](https://github.com/Azure/deploy-to-azure-cli-extension) in the Azure CLI to configure the workflow. The `az container app up` command in the extension takes minimal input parameters from you to set up a workflow to deploy to Azure Container Instances.
201
+
Alternatively, use the [Deploy to Azure extension](https://github.com/Azure/deploy-to-azure-cli-extension) in the Azure CLI to configure the workflow. The `az container app up` command in the extension takes input parameters from you to set up a workflow to deploy to Azure Container Instances.
200
202
201
203
The workflow created by the Azure CLI is similar to the workflow you can [create manually using GitHub](#configure-github-workflow).
202
204
203
-
### Additional prerequisites
205
+
### Additional prerequisite
204
206
205
-
In addition to the [prerequisites](#prerequisites) and [workflow setup](#workflow-setup) for this scenario, you need to install the **Deploy to Azure extension** for the Azure CLI.
207
+
In addition to the [prerequisites](#prerequisites) and [repo setup](#set-up-repo) for this scenario, you need to install the **Deploy to Azure extension** for the Azure CLI.
206
208
207
209
Run the [az extension add][az-extension-add] command to install the extension:
When prompted, provide your GitHub credentials. The command then creates a personal access token (PAT) to authenticate with your registry. The token has *repo* and *user* scopes on the repo. Alternatively, [create your own PAT](https://help.github.com/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) with those scopes and supply the PAT when prompted.
233
+
### Command progress
234
234
235
-
The commandcreates:
235
+
* When prompted, provide your GitHub credentials or provide a [GitHub personal access token](https://help.github.com/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) (PAT) that has *repo* and *user* scopes to authenticate with your registry. If you provide GitHub credentials, the command creates a PAT for you.
236
236
237
-
* Service principal credentials for the workflow
238
-
* Credentials to access the Azure container registry
239
-
* A YAML file to define the GitHub workflow. Accept the default filename `main.yml`, or provide a filename you choose.
237
+
* The command creates repo secrets for the workflow:
240
238
241
-
After you commit the workflow file to your repo, the workflow is triggered. Output is similar to:
239
+
* Service principal credentials for the Azure CLI
240
+
* Credentials to access the Azure container registry
241
+
242
+
* After the command commits the workflow file to your repo, the workflow is triggered.
243
+
244
+
Output is similar to:
242
245
243
246
```console
244
247
[...]
@@ -252,7 +255,7 @@ Your app is deployed at: http://acr-build-helloworld-node.eastus.azurecontainer
252
255
253
256
### Validate workflow
254
257
255
-
The workflow deploys an Azure container instance with the base name of your GitHub repo, in this case, *acr-build-helloworld-node*. In your browser, you can browse to the link provided to view the running web app.
258
+
The workflow deploys an Azure container instance with the base name of your GitHub repo, in this case, *acr-build-helloworld-node*. In your browser, you can browse to the link provided to view the running web app. If your app listens on a port other than 8080, specify that in the URL instead.
256
259
257
260
To view the workflow status and results of each step in the GitHub UI, see [Managing a workflow run](https://help.github.com/actions/configuring-and-managing-workflows/managing-a-workflow-run).
258
261
@@ -288,7 +291,7 @@ Browse the [GitHub Marketplace](https://github.com/marketplace?type=actions) for
0 commit comments