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.
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]