How to run Procfile with multiple commands on Heroku?

ummahusla picture ummahusla · Jun 24, 2017 · Viewed 11.8k times · Source

I'm trying to deploy the static website to Heroku and I struggle how to correctly setup the Procfile.

I have next command to run on the server:

  • npm install
  • gulp build (will make a build with /public folder)
  • http-server (will serve /public by default)

What I've tried:

  • web: npm install; gulp build; http-server
  • web: npm install & gulp build & http-server

Answer

ummahusla picture ummahusla · Jun 24, 2017

Okay, so I've spent a bit of time on that and came up with the answer. By default, heroku is installing all packages from the package.json file, so npm install is no longer required. Then what was left - gulp build and http-server.

For that case, I've added "postinstall" : "gulp build" to my package.json and it left me with web: http-server.

Simplifying things have actually solved the problem. Not sure how useful that information might be to you, but it's worth to share.