Bower

If you're using Bower to install web dependencies for your app and you're
deploying your app to App Engine flexible environment, then there are
several ways to make sure the dependencies are available to your deployed app.
This tutorial discusses three different methods.

Prepare

Easiest: Do nothing

When you deploy to App Engine flexible enviroment a Docker image is created for
you and your code is copied into the image. This first method relies on the
Docker image build step to make Bower dependencies available to your app. This
method is the easiest.

This method is simple:

Install Bower dependencies locally

Deploy

For example:

cd my-app
bower install
gcloud app deploy

The Bower dependencies will be installed, and during the deployment the files
will be copied into the Docker image, and thus will be available to your
deployed app.

Less easy: Use package.json

Let's say you don't want locally installed Bower dependencies to be copied
into the Docker image. To make the dependencies available to your deployed app,
you can have the dependencies installed inside the Docker image as it is
constructed.

Run the following command to generate an `app.yaml file if you don't already
have one:

gcloud app gen-config . --runtime=nodejs

To prevent locally installed Bower dependencies from being copied into the
Docker image, add the following to app.yaml:

The ellipses hide other configurations that may exist in package.json.

Now deploy:

gcloud app deploy

As the Docker image is built it will run npm install, which will in turn
run bower install.

Much less easy: Use a Dockerfile

Another method that does not rely on package.json is to use a custom
Dockerfile.

To make Docker install the Bower dependencies you need to use runtime: custom.
Here we assume you're deploying a Node.js app, but with a little extra
customization in the Dockerfile you can make this work for other languages.

Run the following command to generate the necessary files:

gcloud app gen-config . --custom --runtime=nodejs

This generates three files: Dockerfile, .dockerignore, and app.yaml.

To prevent locally installed Bower dependencies from being copied into the
Docker image. Add the following to app.yaml: