I want to cache the previously stored google cloud image while creating a new build for the project. I have followed the official documentation : https://cloud.google.com/build/docs/optimize-builds/speeding-up-builds but while building it doesn't seems to be caching the data. The yaml file I am using is:
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build','--cache-from', 'gcr.io/PROJECT_ID/node-app:latest', '-t', 'gcr.io/PROJECT_ID/node-app:latest', '.']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/PROJECT_ID/node-app:latest']
images:
- 'gcr.io/PROJECT_ID/node-app:latest'
I also tried to first pull the docker image as:
steps
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/PROJECT_ID/node-app:latest || exit 0']
- name: 'gcr.io/cloud-builders/docker'
args: ['build','--cache-from', 'gcr.io/PROJECT_ID/node-app:latest', '-t', 'gcr.io/PROJECT_ID/node-app:latest', '.']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/PROJECT_ID/node-app:latest']
images:
- 'gcr.io/PROJECT_ID/node-app:latest'
I checked there is image already present and it is also pulling the image but it's not caching the image. How can I cache the image or is there any other process to do so in google cloud?