How to run Procfile with multiple commands on Heroku?

I am trying to deploy a static website in Heroku and I am trying to set it up correctly Procfile.

I have the following command to run on the server:

  • npm install
  • gulp build(will create an assembly with a folder /public)
  • http-server(will serve /publicby default)

What I tried:

  • web: npm install; gulp build; http-server
  • web: npm install & gulp build & http-server
+4
source share
2 answers

Ok, so I spent a little time on this and came up with an answer. By default, heroku installs all packages from a file package.json, so it is npm installno longer required. Then it remained - gulp buildand http-server.

"postinstall" : "gulp build" package.json, web: http-server.

. , , .

+7

, && , .

, Procfile , npm script.


npm, (npm-scripts).

(heroku-build-process).

"scripts": {
    "start": "node index.js",
    "test": "mocha",
    "postinstall": "bower install && grunt build"
}

", ", . , , buildpack.

+1
source

Source: https://habr.com/ru/post/1680013/


All Articles