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
To simplify the execution of the module, we will assume that the azure resource "Azure Container Registry" is already provisioned and it contains the latest images of the three services. If we deployed ACR part of the Bicep scripts, then we can't build and push images to the created ACR in an automated way because creating the three ACA container apps is reliant on ACR's images.
36
+
To simplify the execution of the module, we will assume that you have already created latest images of three services and pushed them to a container registry. [This section](#deploy-the-infrastructure-and-create-the-components) below guides you through
37
+
different options of getting images pushed to either Azure Container Registry (ACR) or GitHub Container Registry (GHCR).
38
+
39
+
If we created and deployed container registery as part of the Bicep scripts, then we can't build and push images to the created ACR in an automated way because creating the three ACA container apps is reliant on ACR's images.
37
40
38
-
In a production setting, a DevOps pipeline would be in place to automate the whole process - commencing with ACR creation, followed by building and pushing docker images, and concluding with executing the Bicep script to establish the remaining resources. As it is outside the scope of this workshop, we will not delve into the creation of a DevOps pipeline here.
41
+
In a production setting, a DevOps pipeline would be in place to automate the whole process - commencing with ACR creation, followed by building and pushing docker images, and concluding with executing the
42
+
Bicep script to establish the remaining resources. As it is outside the scope of this workshop, we will not delve into the creation of a DevOps pipeline here.
43
+
39
44
#### 1. Add the Needed Extension to VS Code
40
45
To proceed, you must install an extension called [Bicep](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep). This extension will simplify building Bicep files as it offers IntelliSense, Validation, listing all available resource types, etc..
41
46
@@ -273,47 +278,185 @@ To achieve this, add a new file under the `bicep` directory as shown below:
273
278
Start by creating a new resource group which will contain all the resources to be created by the Bicep scripts.
274
279
275
280
```Powershell
276
-
az group create `
277
-
--name "<your RG name>" `
278
-
--location "eastus"
279
-
```
280
-
281
-
Next create an ACR inside the newly created Resource Group:
281
+
$RESOURCE_GROUP="<your RG name>"
282
+
$LOCATION="<your location>"
282
283
283
-
```Powershell
284
-
az acr create `
285
-
--resource-group <your RG name> `
286
-
--name <your ACR name>`
287
-
--sku Basic `
288
-
--admin-enabled true
284
+
az group create `
285
+
--name $RESOURCE_GROUP `
286
+
--location $LOCATION
289
287
```
290
288
291
-
!!! note
292
-
Once the RG and ACR are created you can check [this section](../../aca/08-aca-monitoring/index.md#2-build-new-images-and-push-them-to-acr) which shows the different commands to build and push the images to ACR. Make sure you are at the root project directory when executing the aforementioned commands. Finally run the bicep file against the newly created Resource Group as shown below.
293
-
294
-
With the steps above completed we are ready to deploy all the different resources. We just need to create a parameters file which will simplify the invocation of the main bicep file.
289
+
Create a parameters file which will simplify the invocation of the main bicep file. To achieve this, right click on file `main.bicep` and select **Generate Parameter File**.
290
+
This will result in creating a file named `main.parameters.json` similar to the file below:
295
291
296
-
To achieve this, right click on file `main.bicep` and select **Generate Parameter File**. This will result in creating a file named `main.parameters.json` similar to the file below:
To use this file, you need to edit this generated file and provide values for the parameters. You can use the same values shown above in sample file.
308
-
309
-
You only need to replace parameter values between the angle brackets `<>` with values related to your ACR resource and SendGrid.
302
+
303
+
You only need to replace parameter values between the angle brackets `<>` with values related to your container registry and SendGrid. Values for container registry and container images can be dervied by following
304
+
one of the three options in next step.
305
+
306
+
Next, we will prepare container images for the three container apps and update the values in `main.parameters.json` file. You can do so by any of the three options below:
307
+
308
+
=== "Option 1: Build and Push the Images to Azure Container Registry (ACR)"
309
+
310
+
1. Create an Azure Container Registry (ACR) inside the newly created Resource Group:
311
+
312
+
```Powershell
313
+
$CONTAINER_REGISTRY_NAME="<your ACR name>"
314
+
315
+
az acr create `
316
+
--resource-group $RESOURCE_GROUP `
317
+
--name $CONTAINER_REGISTRY_NAME `
318
+
--sku Basic `
319
+
--admin-enabled true
320
+
```
321
+
322
+
2. Build and push the images to ACR as guided in [this section](../../aca/08-aca-monitoring/index.md#2-build-new-images-and-push-them-to-acr). Make sure you are at the root project directory when executing the following commands:
323
+
324
+
```Powershell
325
+
326
+
## Build Backend API on ACR and Push to ACR
327
+
328
+
az acr build --registry $CONTAINER_REGISTRY_NAME `
=== "Option 2: Import pre-built public images to your private Azure Container Registry"
372
+
373
+
All the container image are available in a public image repository. If you do not wish to build the container images from code directly, you can import it directly into
374
+
your private container instance as shown below.
375
+
376
+
1. Create an Azure Container Registry (ACR) inside the newly created Resource Group:
377
+
378
+
```Powershell
379
+
az acr create `
380
+
--resource-group $RESOURCE_GROUP `
381
+
--name <your ACR name>`
382
+
--sku Basic `
383
+
--admin-enabled true
384
+
```
385
+
2. Import the images to your private ACR as shown below:
=== "Option 3: Use the pre-built images from the public repository"
432
+
433
+
All the container image are available in a public image repository. If you do not wish to build the container images from code directly, you can use the pre-built images from the public repository as shown below.
434
+
435
+
The public images can be set directly in the `main.parameters.jsonc` file:
0 commit comments