Search code examples
node.jsgoogle-app-enginepackage.jsongoogle-apps

Can Google App Engine (flexible environment) perform a build step defined in package.json just before deployment?


I couldn't find any documentation about build steps on the flexible environment. Only thing I found is that App Engine will run the start script from your package.json file after deployment, but is it possible to make it run the build script first? This is what Heroku does and I want to replicate it.


Solution

  • What you're looking for is the script called gcp-build as this one can perform a custom build step at deployment, just before starting the application. While this is only documented for Standard Environment as of now (I've let the engineers know), there are multiple public resources that can confirm this works on both environments. See the following links as reference:

    1. Why does Google App Engine flex build step fail while standard works for the same code?

    2. https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/typescript