gogoogle-app-enginegoogle-cloud-platformgoogle-app-engine-golang

How to have custom Go build flags and tools on GCP App Engine?


When using the App Engine' standard Go environment (https://cloud.google.com/appengine/docs/standard/go) is there a way to have custom go build flags but also tool?

Ideally, I'd love to have:

  1. go install of the tool
  2. go build with flags using the tool

But I can't find any way to customize the automated build of that App Engine environment.


Solution

  • Only way I'm aware of is using GCP AppEngine Flexible environment (see https://cloud.google.com/appengine/docs/flexible). You basically specify flex environment in your app.yaml:

    runtime: custom
    env: flex
    

    and then you can reuse standard AppEngine Go multi-stage Dockerfile by using directive FROM gcr.io/google-appengine/golang (mirrored on Github here: https://github.com/GoogleCloudPlatform/golang-docker) and extending it to do whatever you need.

    There are some things you need to be aware when going from standard to flexible (e.g. monitoring, logging, authentication, etc.) but all those are discussed on Flexible environment page I linked above and you can reach state where flexible pretty much behaves like standard (or at least as far as I am aware).