How to use Google Cloud Build + Bazel to deploy to App Engine?

  bazel, docker, google-app-engine, google-cloud-build

I’m using bazel as my build process for a monorepo, and I’m going to be using App Engine for the client side of the application.

- client/
  - app.yaml
  - BUILD
  - main.py
  - app/ - angular app
cloudbuild.yaml
WORKSPACE

I’m using pkg_web to package up the client side app, with the app.yaml and main.py included as part of that package.

I can successfully build that using bazel build //client:bundle.

I’ve experimented with differnet ways to deploy that to app engine using cloudbuild, but no luck so far.

steps:
  - name: 'gcr.io/cloud-marketplace-containers/google/bazel'
    args: ['build', '//client:bundle', '--verbose_failures']
  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    entrypoint: 'bash'
    args: ['-c', 'gcloud app deploy ./client/app.yaml']

How do I build and deploy the result of //client:bundle? This obviously just deploys the source directory and not the output of the build.

I’ve also experimented with building a py_image docker container instead and trying to deploy that, but no luck. Any help would be appreciated!

Source: Docker Questions

LEAVE A COMMENT