My web application runs in Google Cloud Platform, lately I realized that application's build time takes really long, especially when you are testing a feature, let say refresh the page, you can see that it takes really long to start application. What I am looking for is how to speed up this process. I am using docker images to build on google cloud registry. I do not want to re-build all npm packages every time, when there is an update in some npm packages then I want to re-build application.
here is the my cloudbuild.yaml file for polymer
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/myapp-polymer', '.' ]
images:
- 'gcr.io/$PROJECT_ID/myapp-polymer'
then here is the my main cloudbuild.yaml file
steps:
- name: 'gcr.io/cloud-builders/npm'
args: ['--prefix', 'myapp','install']
- name: 'gcr.io/cloud-builders/npm'
args: ['--prefix', 'myapp/functions', 'install']
- name: 'gcr.io/$PROJECT_ID/myapp-polymer'
args: ['cd', 'myapp']
- name: 'gcr.io/$PROJECT_ID/myapp-polymer'
args: ['build']
I read Google Cloud API especially section "Speeding up your Builds" (https://cloud.google.com/cloud-build/docs/speeding-up-builds)
I think it just cache build images and using it. Are there any way that I can cache specifically npm packages, dependencies etc in Google Cloud so that I do not have to build every time whole application? My main goal is to reduce build time, speed up build process.
Thanks!