Articles in this section

Build process (build hook)

Your application gets built during the build phase, using the configuration files committed to the code repository and the core building configuration in .platform.app.yaml. The following events happen during the build phase:

build-pipeline.svg

Build Hook

The build hook can be used to run commands that retrieve dependencies and build the application

hooks:
build: |
npm run setup-assets
npm run build

It can even be used to download and setup external libraries as shown in setting up custom Node.js versions. For further examples, review the language specific setup docs and our existing templates

 

Build Flavor

For some languages (e.g. Node.js and PHP), a build flavor is available that specifies a default set of build tasks to run. Below shows the commands the default build flavor runs if the dependency file exists

npm prune --userconfig .npmrc && npm install --userconfig .npmrc
  • PHP (if composer.jsonexists)
composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader

For languages with a build flavor, you can remove the default build flavor and run your own commands for complete control over your build

  • Set the build flavor to none
  • Add the commands you need to your build hook, as in the following example:
build:
    flavor: none

hooks:
    build: |
        set -e
        composer install --no-interaction --no-dev        

 

Further References

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.