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-apps/containerapp-up.md
+27-31Lines changed: 27 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,10 +28,11 @@ The `up` command can create or use existing resources including:
28
28
- Resource group
29
29
- Azure Container Registry
30
30
- Container Apps environment and Log Analytics workspace
31
+
- the container app
31
32
32
-
The command can build and push a container image to an Azure Container Registry (ACR) when you provide local source code or a GitHub repo. When you're working from a GitHub repo, it creates a GitHub Action that automatically builds and pushes a new container image when you commit changes to your GitHub repo.
33
+
The command can build and push a container image to an Azure Container Registry (ACR) when you provide local source code or a GitHub repo. When you're working from a GitHub repo, it creates a GitHub Actions workflow that automatically builds and pushes a new container image when you commit changes to your GitHub repo.
33
34
34
-
If you need to customize the Container App environment, first create the environment using the `az containerapp env create` command. If you don't provide an existing environment, the `up` command looks for one in your resource group and, if found, uses that environment. If not found, it creates an environment with a Log Analytics workspace.
35
+
If you need to customize the Container Apps environment, first create the environment using the `az containerapp env create` command. If you don't provide an existing environment, the `up` command looks for one in your resource group and, if found, uses that environment. If not found, it creates an environment with a Log Analytics workspace.
35
36
36
37
To learn more about the `az containerapp up` command and its options, see [`az containerapp up`](/cli/azure/containerapp#az_containerapp_up).
37
38
@@ -42,14 +43,13 @@ To learn more about the `az containerapp up` command and its options, see [`az c
42
43
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. Refer to [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.md?tabs=current) for details. |
43
44
| GitHub Account | If you use a GitHub repo, sign up for [free](https://github.com/join). |
44
45
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
45
-
| Docker Desktop | If you're using local source code with a Dockerfile, you'll need to install Docker Desktop. Docker provides installers that configure the Docker environment on [macOS](https://docs.docker.com/docker-for-mac/), [Windows](https://docs.docker.com/docker-for-windows/), and [Linux](https://docs.docker.com/engine/installation/#supported-platforms). After installation, type `docker` from your command prompt to ensure Docker is running. |
46
46
|Local source code | You need to have a local source code directory if you use local source code. |
47
47
| Existing Image | If you use an existing image, you'll need your registry server, image name, and tag. If you're using a private registry, you'll need your credentials. |
48
48
49
49
## Set up
50
50
51
51
1. Log in to Azure with the Azure CLI.
52
-
52
+
53
53
```azurecli
54
54
az login
55
55
```
@@ -61,21 +61,19 @@ To learn more about the `az containerapp up` command and its options, see [`az c
61
61
62
62
1. Now that the current extension or module is installed, register the `Microsoft.App` namespace.
63
63
64
-
65
64
```azurecli
66
65
az provider register --namespace Microsoft.App
67
66
```
68
67
69
68
1. Register the `Microsoft.OperationalInsights` provider for the Azure Monitor Log Analytics workspace.
70
69
71
-
72
70
```azurecli
73
71
az provider register --namespace Microsoft.OperationalInsights
74
72
```
75
73
76
74
## Deploy from an existing image
77
75
78
-
You can deploy a container app that uses an existing image in a public or private container registry.
76
+
You can deploy a container app that uses an existing image in a public or private container registry. If you are deploying from a private registry, you'll need to provide your credentials using the `registry-server`, `--registry-username`, and `--registry-password` options.
79
77
80
78
In this example, the `az containerapp up` command performs the following actions:
81
79
@@ -110,9 +108,14 @@ az containerapp up \
110
108
111
109
When you use the `up` command to deploy from a local source, it builds the container image, pushes it to a registry, and deploys the container app. It creates the registry in Azure Container Registry if you don't provide one.
112
110
113
-
The command can build the image with or without a Dockerfile. If building without a Dockerfile, there are two requirements:
111
+
The command can build the image with or without a Dockerfile. If building without a Dockerfile the following languages are supported:
114
112
115
-
TODO: What are the requirements?
113
+
- .NET
114
+
- Node.js
115
+
- PHP
116
+
- Python
117
+
- Ruby
118
+
- Go
116
119
117
120
The following example shows how to deploy a container app from local source code.
118
121
@@ -125,26 +128,22 @@ In the example, the `az containerapp up` command performs the following actions:
125
128
1. Pushes the image to the registry.
126
129
1. Creates and deploys the container app.
127
130
128
-
Follow these steps to deploy a container app from local source code:
129
-
130
-
1. Change to the directory containing your source code and, optionally, your Dockerfile, for the container image.
131
+
Run the following command to deploy a container app from local source code:
131
132
132
-
TODO: Since they're specifying the source directory in the command, do they need to be in the source directory? And if they are in the source directory, do they need to specify the source directory in the command?
133
-
134
-
1. Run the following command:
135
-
136
-
```azurecli
133
+
```azurecli
137
134
az containerapp up \
138
135
--name <CONTAINER_APP_NAME> \
139
-
--source <SOURCE_DIRECTORY>
136
+
--source <SOURCE_DIRECTORY>\
137
+
--ingress external
138
+
```
140
139
141
-
When the Dockerfile includes the EXPOSE instruction, the `up` command configures the container app's ingress and target port using the information in the Dockerfile.
140
+
When the Dockerfile includes the EXPOSE instruction, the `up` command configures the container app's ingress and target port using the information in the Dockerfile.
142
141
143
-
The output of the command includes the URL for the container app.
142
+
If you've configured ingress through your Dockerfile or your app doesn't require ingress, you can omit the `ingress` option.
144
143
145
-
If there's a failure, you can run the command again with the `--debug` option to get more information about the failure.
144
+
The output of the command includes the URL for the container app.
146
145
147
-
TODO: What do we want to say if there's a failure?
146
+
If there's a failure, you can run the command again with the `--debug` option to get more information about the failure. If the build fails without a Dockerfile, you can try adding a Dockerfile and running the command again.
148
147
149
148
To use the `az containerapp up` command to redeploy your container app with an updated image, include the `--resource-group` and `--environment` arguments. The following example shows how to redeploy a container app from local source code.
150
149
@@ -161,16 +160,10 @@ To use the `az containerapp up` command to redeploy your container app with an u
161
160
162
161
## Deploy from a GitHub repository
163
162
164
-
When you use the `az containerapp up` command to deploy from a GitHub repository, it builds the container image, pushes it to a registry, and deploys the container app. The command creates the registry in Azure Container Registry if you don't provide one.
163
+
When you use the `az containerapp up` command to deploy from a GitHub repository, it generates a GitHub Actions workflow that builds the container image, pushes it to a registry, and deploys the container app. The command creates the registry in Azure Container Registry if you don't provide one.
165
164
166
-
When your repository contains a Dockerfile, the `up` command builds the image using the Dockerfile. When the Dockerfile includes the EXPOSE instruction, the command configures the container app's ingress and target port using the information in the Dockerfile.
165
+
A Dockerfile is required to build the image. When the Dockerfile includes the EXPOSE instruction, the command configures the container app's ingress and target port using the information in the Dockerfile.
167
166
168
-
The `up` command can also build the image without a Dockerfile. If building without a Dockerfile, there are two requirements:
169
-
170
-
TODO: What are the requirements?
171
-
172
-
The command will create a GitHub Actions workflow that builds the image and deploys the container app when changes are pushed to the repository.
173
-
174
167
The following example shows how to deploy a container app from a GitHub repository.
175
168
176
169
In the example, the `az containerapp up` command performs the following actions:
@@ -188,9 +181,12 @@ To deploy an app from a GitHub repository, run the following command:
188
181
```azurecli
189
182
az containerapp up \
190
183
--name <CONTAINER_APP_NAME> \
191
-
--repo <GitHub repository URL>
184
+
--repo <GitHub repository URL> \
185
+
--ingress external
192
186
```
193
187
188
+
If you've configured ingress through your Dockerfile or your app doesn't require ingress, you can omit the `ingress` option.
189
+
194
190
Because the `up` command creates a GitHub Actions workflow, rerunning it to deploy changes to your app's image will have the unwanted effect of creating multiple workflows. Instead, push changes to your GitHub repository, and the GitHub workflow will automatically build and deploy your app. To change the workflow, edit the workflow file in GitHub.
0 commit comments