1

I'm building a custom image for App Engine Flexible with gcloud app deploy currently. I've played with using Kaniko to get caching working with gcloud builds submit for other projects, but is it possible to enable Kaniko for a build submitted with gcloud app deploy?

I've tried running gcloud config set builds/use_kaniko True, which doesn't seem to change the build behavior.

It seems like one option would be to build an image first via gcloud builds submit, then use gcloud app deploy --image-url=..., but I wasn't sure if there was a more streamlined way.

jon_wu
  • 1,113
  • 11
  • 26
  • Hi, can you share the `cloudbuild.yaml` you have used? – llompalles Aug 13 '19 at 14:31
  • @llompalles because I'm using `gcloud app deploy`, I don't have have a `cloudbuild.yaml`; I only have an `app.yaml`, which doesn't really have any build info in it except that I'm creating a custom image, then I also have a `Dockerfile`. Is it possible to use Kaniko with the `gcloud app deploy` for App Engine Flexible? – jon_wu Aug 13 '19 at 17:27

1 Answers1

1

As you already said in your question, a good approach would be to first use Google Cloud Build to create your own image using your Dockerfile to then use it when deploying your application to Google App Engine.

In Google Cloud Container Builder you can run Kaniko by adding it as a build step in the build config:

steps:
 - name: gcr.io/kaniko-project/executor:latest
   args: ["--dockerfile=<path to Dockerfile>",
          "--context=<path to build context>",
          "--destination=<gcr.io/[PROJECT]/[IMAGE]:[TAG]>"]

More information can be found in these two blog posts about Google Cloud and kaniko. Post 1 & 2.

After that you can deploy your application by specifying the --image-url flag in the gcloud command:

gcloud app deploy --image-url=gcr.io/[PROJECT]/[IMAGE]:[TAG]
bhito
  • 2,083
  • 7
  • 13