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/app-service/containers/configure-language-dotnetcore.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,28 @@ Run the following command in the [Cloud Shell](https://shell.azure.com) to set t
36
36
az webapp config set --name <app-name> --resource-group <resource-group-name> --linux-fx-version "DOTNETCORE|2.1"
37
37
```
38
38
39
+
## Customize build automation
40
+
41
+
If you deploy your app using Git or zip packages with build automation turned on, the App Service build automation steps through the following sequence:
42
+
43
+
1. Run custom script if specified by `PRE_BUILD_SCRIPT_PATH`.
44
+
1. Run `dotnet restore` to restore NuGet dependencies.
45
+
1. Run `dotnet publish` to build a binary for production.
46
+
1. Run custom script if specified by `POST_BUILD_SCRIPT_PATH`.
47
+
48
+
`PRE_BUILD_COMMAND` and `POST_BUILD_COMMAND` are environment variables that are empty by default. To run pre-build commands, define `PRE_BUILD_COMMAND`. To run post-build commands, define `POST_BUILD_COMMAND`.
49
+
50
+
The following example specifies the two variables to a series of commands, separated by commas.
51
+
52
+
```azurecli-interactive
53
+
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings PRE_BUILD_COMMAND="echo foo, scripts/prebuild.sh"
54
+
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings POST_BUILD_COMMAND="echo foo, scripts/postbuild.sh"
55
+
```
56
+
57
+
For additional environment variables to customize build automation, see [Oryx configuration](https://github.com/microsoft/Oryx/blob/master/doc/configuration.md).
58
+
59
+
For more information on how App Service runs and builds ASP.NET Core apps in Linux, see [Oryx documentation: How .NET Core apps are detected and built](https://github.com/microsoft/Oryx/blob/master/doc/runtimes/dotnetcore.md).
60
+
39
61
## Access environment variables
40
62
41
63
In App Service, you can [set app settings](../configure-common.md?toc=%2fazure%2fapp-service%2fcontainers%2ftoc.json#configure-app-settings) outside of your app code. Then you can access them in any class using the standard ASP.NET Core dependency injection pattern:
Copy file name to clipboardExpand all lines: articles/app-service/containers/configure-language-nodejs.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,32 @@ This setting specifies the Node.js version to use, both at runtime and during au
40
40
> [!NOTE]
41
41
> You should set the Node.js version in your project's `package.json`. The deployment engine runs in a separate container that contains all the supported Node.js versions.
42
42
43
+
## Customize build automation
44
+
45
+
If you deploy your app using Git or zip packages with build automation turned on, the App Service build automation steps through the following sequence:
46
+
47
+
1. Run custom script if specified by `PRE_BUILD_SCRIPT_PATH`.
48
+
1. Run `npm install` without any flags, which includes npm `preinstall` and `postinstall` scripts and also installs `devDependencies`.
49
+
1. Run `npm run build` if a build script is specified in your *package.json*.
50
+
1. Run `npm run build:azure` if a build:azure script is specified in your *package.json*.
51
+
1. Run custom script if specified by `POST_BUILD_SCRIPT_PATH`.
52
+
53
+
> [!NOTE]
54
+
> As described in [npm docs](https://docs.npmjs.com/misc/scripts), scripts named `prebuild` and `postbuild` run before and after `build`, respectively, if specified. `preinstall` and `postinstall` run before and after `install`, respectively.
55
+
56
+
`PRE_BUILD_COMMAND` and `POST_BUILD_COMMAND` are environment variables that are empty by default. To run pre-build commands, define `PRE_BUILD_COMMAND`. To run post-build commands, define `POST_BUILD_COMMAND`.
57
+
58
+
The following example specifies the two variables to a series of commands, separated by commas.
59
+
60
+
```azurecli-interactive
61
+
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings PRE_BUILD_COMMAND="echo foo, scripts/prebuild.sh"
62
+
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings POST_BUILD_COMMAND="echo foo, scripts/postbuild.sh"
63
+
```
64
+
65
+
For additional environment variables to customize build automation, see [Oryx configuration](https://github.com/microsoft/Oryx/blob/master/doc/configuration.md).
66
+
67
+
For more information on how App Service runs and builds Node.js apps in Linux, see [Oryx documentation: How Node.js apps are detected and built](https://github.com/microsoft/Oryx/blob/master/doc/runtimes/nodejs.md).
68
+
43
69
## Configure Node.js server
44
70
45
71
The Node.js containers come with [PM2](https://pm2.keymetrics.io/), a production process manager. You can configure your app to start with PM2, or with NPM, or with a custom command.
Copy file name to clipboardExpand all lines: articles/app-service/containers/configure-language-php.md
+14-40Lines changed: 14 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,56 +36,30 @@ Run the following command in the [Cloud Shell](https://shell.azure.com) to set t
36
36
az webapp config set --name <app-name> --resource-group <resource-group-name> --linux-fx-version "PHP|7.2"
37
37
```
38
38
39
-
## Run Composer
39
+
## Customize build automation
40
40
41
-
By default, Kudu doesn't run [Composer](https://getcomposer.org/). To enable Composer automation during Kudu deployment, you need to supply a [custom deployment script](https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script).
41
+
If you deploy your app using Git or zip packages with build automation turned on, the App Service build automation steps through the following sequence:
42
42
43
-
From a local terminal window, change directory to your repository root. Follow the [command-line installation steps](https://getcomposer.org/download/) to download *composer.phar*.
43
+
1. Run custom script if specified by `PRE_BUILD_SCRIPT_PATH`.
44
+
1. Run `php composer.phar install`.
45
+
1. Run custom script if specified by `POST_BUILD_SCRIPT_PATH`.
44
46
45
-
Run the following commands:
47
+
`PRE_BUILD_COMMAND` and `POST_BUILD_COMMAND` are environment variables that are empty by default. To run pre-build commands, define `PRE_BUILD_COMMAND`. To run post-build commands, define `POST_BUILD_COMMAND`.
Your repository root now has two new files in addition to *composer.phar*: *.deployment* and *deploy.sh*. These files work both for Windows and Linux flavors of App Service.
53
-
54
-
Open *deploy.sh* and find the `Deployment` section. Replace the whole section with the following code:
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings PRE_BUILD_COMMAND="echo foo, scripts/prebuild.sh"
53
+
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings POST_BUILD_COMMAND="echo foo, scripts/postbuild.sh"
82
54
```
83
55
84
-
Commit all your changes and deploy your code again. Composer should now be running as part of deployment automation.
56
+
For additional environment variables to customize build automation, see [Oryx configuration](https://github.com/microsoft/Oryx/blob/master/doc/configuration.md).
57
+
58
+
For more information on how App Service runs and builds PHP apps in Linux, see [Oryx documentation: How PHP apps are detected and built](https://github.com/microsoft/Oryx/blob/master/doc/runtimes/php.md).
85
59
86
60
## Customize start-up
87
61
88
-
By default, the built-in PHP container run the Apache server. At start-up, it runs `apache2ctl -D FOREGROUND"`. If you like, you can run a different command at start-up, by running the following command in the [Cloud Shell](https://shell.azure.com):
62
+
By default, the built-in PHP container runs the Apache server. At start-up, it runs `apache2ctl -D FOREGROUND"`. If you like, you can run a different command at start-up, by running the following command in the [Cloud Shell](https://shell.azure.com):
89
63
90
64
```azurecli-interactive
91
65
az webapp config set --resource-group <resource-group-name> --name <app-name> --startup-file "<custom-command>"
Copy file name to clipboardExpand all lines: articles/app-service/containers/how-to-configure-python.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,28 @@ Run the following command in the [Cloud Shell](https://shell.azure.com) to set t
44
44
az webapp config set --resource-group <resource-group-name> --name <app-name> --linux-fx-version "PYTHON|3.7"
45
45
```
46
46
47
+
## Customize build automation
48
+
49
+
If you deploy your app using Git or zip packages with build automation turned on, the App Service build automation steps through the following sequence:
50
+
51
+
1. Run custom script if specified by `PRE_BUILD_SCRIPT_PATH`.
52
+
1. Run `pip install -r requirements.txt`.
53
+
1. If *manage.py* is found in the root of the repository, run *manage.py collectstatic*. However, if `DISABLE_COLLECTSTATIC` is set to `true`, this step is skipped.
54
+
1. Run custom script if specified by `POST_BUILD_SCRIPT_PATH`.
55
+
56
+
`PRE_BUILD_COMMAND`, `POST_BUILD_COMMAND`, and `DISABLE_COLLECTSTATIC` are environment variables that are empty by default. To run pre-build commands, define `PRE_BUILD_COMMAND`. To run post-build commands, define `POST_BUILD_COMMAND`. To disable running collectstatic when building Django apps, set `DISABLE_COLLECTSTATIC=true`.
57
+
58
+
The following example specifies the two variables to a series of commands, separated by commas.
59
+
60
+
```azurecli-interactive
61
+
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings PRE_BUILD_COMMAND="echo foo, scripts/prebuild.sh"
62
+
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings POST_BUILD_COMMAND="echo foo, scripts/postbuild.sh"
63
+
```
64
+
65
+
For additional environment variables to customize build automation, see [Oryx configuration](https://github.com/microsoft/Oryx/blob/master/doc/configuration.md).
66
+
67
+
For more information on how App Service runs and builds Python apps in Linux, see [Oryx documentation: How Python apps are detected and built](https://github.com/microsoft/Oryx/blob/master/doc/runtimes/python.md).
68
+
47
69
## Container characteristics
48
70
49
71
Python apps deployed to App Service on Linux run within a Docker container that's defined in the [App Service Python GitHub repository](https://github.com/Azure-App-Service/python). You can find the image configurations inside the version-specific directories.
> You may notice that the deployment process installs [Composer](https://getcomposer.org/) packages at the end. App Service does not run these automations during default deployment, so this sample repository has three additional files in its root directory to enable it:
403
403
>
404
404
> - `.deployment` - This file tells App Service to run `bash deploy.sh` as the custom deployment script.
405
405
> - `deploy.sh` - The custom deployment script. If you review the file, you will see that it runs `php composer.phar install` after `npm install`.
406
406
> - `composer.phar` - The Composer package manager.
407
407
>
408
-
> You can use this approach to add any step to your Git-based deployment to App Service. For more information, see [Run Composer](configure-language-php.md#run-composer).
409
-
>
408
+
> You can use this approach to add any step to your Git-based deployment to App Service. For more information, see [Run Composer](configure-language-php.md#run-composer).-->
0 commit comments