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/javascript-overview.md
+71-71Lines changed: 71 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,58 +174,58 @@ For production builds, make sure you use the correct version tag, which may not
174
174
## Deployment
175
175
To support continuous integration/continuous deployment (CI/CD), set up a CI/CD pipeline using GitHub Actions, Azure DevOps, or another CI/CD tool to automate the deployment process.
176
176
177
-
```yaml
178
-
# .github/workflows/deploy.yml
179
-
name: Deploy to Azure
180
-
181
-
on:
182
-
push:
183
-
branches:
184
-
- main
185
-
186
-
jobs:
187
-
build-and-deploy:
188
-
runs-on: ubuntu-latest
189
-
190
-
steps:
191
-
- uses: actions/checkout@v4
192
-
193
-
- name: Set up Node.js
194
-
uses: actions/setup-node@v4
195
-
with:
196
-
node-version: '22'
197
-
198
-
- name: Install dependencies
199
-
run: npm ci
200
-
201
-
- name: Build the app
202
-
run: npm run build
203
-
204
-
- name: Log in to Azure
205
-
uses: azure/login@v2
206
-
with:
207
-
creds: ${{ secrets.AZURE_CREDENTIALS }}
208
-
209
-
- name: Deploy to Azure Container Apps
210
-
run: |
211
-
az containerapp up \
212
-
--name my-container-app \
213
-
--resource-group my-resource-group \
214
-
--image my-docker-image \
215
-
--environment my-environment \
216
-
--cpu 1 --memory 2Gi \
217
-
--env-vars NODE_ENV=production PORT=3000
218
-
```
177
+
```yaml
178
+
# .github/workflows/deploy.yml
179
+
name: Deploy to Azure
180
+
181
+
on:
182
+
push:
183
+
branches:
184
+
- main
185
+
186
+
jobs:
187
+
build-and-deploy:
188
+
runs-on: ubuntu-latest
189
+
190
+
steps:
191
+
- uses: actions/checkout@v4
192
+
193
+
- name: Set up Node.js
194
+
uses: actions/setup-node@v4
195
+
with:
196
+
node-version: '22'
197
+
198
+
- name: Install dependencies
199
+
run: npm ci
200
+
201
+
- name: Build the app
202
+
run: npm run build
203
+
204
+
- name: Log in to Azure
205
+
uses: azure/login@v2
206
+
with:
207
+
creds: ${{ secrets.AZURE_CREDENTIALS }}
208
+
209
+
- name: Deploy to Azure Container Apps
210
+
run: |
211
+
az containerapp up \
212
+
--name my-container-app \
213
+
--resource-group my-resource-group \
214
+
--image my-docker-image \
215
+
--environment my-environment \
216
+
--cpu 1 --memory 2Gi \
217
+
--env-vars NODE_ENV=production PORT=3000
218
+
```
219
219
220
220
When using Docker Registry, sign into your registry then push your Docker images to a container registry like Azure Container Registry (ACR) or Docker Hub.
221
221
222
-
```bash
223
-
# Tag the image
224
-
docker tag my-app:latest myregistry.azurecr.io/my-app:latest
222
+
```bash
223
+
# Tag the image
224
+
docker tag my-app:latest myregistry.azurecr.io/my-app:latest
225
225
226
-
# Push the image
227
-
docker push myregistry.azurecr.io/my-app:latest
228
-
```
226
+
# Push the image
227
+
docker push myregistry.azurecr.io/my-app:latest
228
+
```
229
229
230
230
## Cold starts
231
231
@@ -243,9 +243,9 @@ Security considerations for JavaScript developers using Azure Container Apps inc
243
243
244
244
Ensure sensitive information such as database connection strings and API keys are stored securely. Use Azure Key Vault to manage secrets and environment variables securely.
245
245
246
-
```bash
247
-
az keyvault secret set --vault-name myKeyVault --name "CosmosDBConnectionString" --value "<your-connection-string>"
248
-
```
246
+
```bash
247
+
az keyvault secret set --vault-name myKeyVault --name "CosmosDBConnectionString" --value "<your-connection-string>"
248
+
```
249
249
250
250
### HTTPS and certificates
251
251
@@ -255,9 +255,9 @@ Ensure your application is served over HTTPS. Azure Container Apps can manage [c
255
255
256
256
Regularly update your dependencies to avoid security vulnerabilities. Use tools like `npm audit` to check for vulnerabilities.
257
257
258
-
```bash
259
-
npm audit
260
-
```
258
+
```bash
259
+
npm audit
260
+
```
261
261
262
262
263
263
## Error handling
@@ -472,15 +472,15 @@ When your application runs into run time issues on Azure Container Apps, you can
472
472
473
473
Enable and configure logging to capture application logs. Use Azure Monitor and Log Analytics to collect and analyze logs.
474
474
475
-
First, create a new workspace.
475
+
1. Create a new workspace.
476
476
477
477
```azurecli
478
478
az monitor log-analytics workspace create \
479
479
--resource-group my-resource-group \
480
480
--workspace-name <WORKSPACE_NAME>
481
481
```
482
482
483
-
Then create a new workspace setting.
483
+
1. Then create a new workspace setting.
484
484
485
485
```azurecli
486
486
az monitor diagnostic-settings create \
@@ -493,26 +493,26 @@ Then create a new workspace setting.
493
493
494
494
Use [remote debugging](#remote-debugging) tools to connect to your running container. Ensure your Dockerfile exposes the necessary ports for debugging.
495
495
496
-
```yaml
497
-
# Expose the debugging port
498
-
EXPOSE 9229
499
-
```
496
+
```yaml
497
+
# Expose the debugging port
498
+
EXPOSE 9229
499
+
```
500
500
501
501
### Health checks
502
502
503
503
Configure health checks to monitor the health of your application. This feature ensures that Azure Container Apps can restart your container if it becomes unresponsive.
0 commit comments