Skip to content

Commit 1968cc8

Browse files
committed
updated node article
1 parent 7f65ba6 commit 1968cc8

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

_posts/2020-04-30-run-production-build-on-app-service-linux.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,37 @@ toc_sticky: true
1616
date: 2020-04-30 00:00:00
1717
---
1818

19-
## Overview
20-
2119
When you create production build for your React, Angular, other Node framework the files will either be placed in a `build` or `dist` directory depending on the framework. App Service on Linux uses *Oryx* to detect, build, and start your application. For more information about how this is done, please go to the [Oryx](https://github.com/microsoft/Oryx/blob/master/doc/runtimes/nodejs.md) GitHub page for more info. In order to serve the built content, you can perform either of the following.
2220

2321
## PM2 Serve
2422

2523
1. In the Azure Portal, go to *Configuration*.
2624
1. Select *General* and locate the *Startup Command* box.
27-
1. If all of the items in the `build` directory are in wwwroot, change the path to /home/site/wwwroot.
25+
1. If all of the items in the `build` directory are in `wwwroot`, change the path to `/home/site/wwwroot`.
26+
```bash
27+
pm2 serve /home/site/wwwroot/build --no-daemon
28+
```
29+
1. If the content is under `dist`, make sure to use the following.
30+
```bash
31+
pm2 serve /home/site/wwwroot/dist --no-daemon
32+
```
2833

29-
```bash
30-
pm2 serve /home/site/wwwroot/build --no-daemon
31-
```
3234
1. Press Save.
3335

3436
## Process File
3537

36-
1. Create a process.json, process.yml, etc. In this example, I'm using a process.json file with the following content and add it to the wwwroot directory.
38+
1. Create a process.json or process.yml and place it in `/home/site/wwwroot`.
39+
1. In this example, I'm using a process.json file and my files are under the `build` directory. Make sure to change this to `dist` if your framework is outputing to the `dist` directory.
3740
38-
```bash
39-
{
40-
"script": "serve",
41-
"env": {
42-
"PM2_SERVE_PATH": './build'
43-
}
44-
"args": '--no-daemon'
45-
}
46-
```
41+
```bash
42+
{
43+
"script": "serve",
44+
"env": {
45+
"PM2_SERVE_PATH": './build'
46+
}
47+
"args": '--no-daemon'
48+
}
49+
```
4750
1. In the Azure Portal, go to *Configuration*.
4851
1. Select *General* and locate the *Startup Command* box and enter `process.json`.
4952
1. Press Save.

0 commit comments

Comments
 (0)