Having a optimized build and CI/CD process results in faster, efficient and cost effective builds.
Here are Top 5 things to start with for CI/CD optimization –
- Build Lean Container Images – Separate building the application from building its runtime layer and build form minimal base images Reference – https://cloud.google.com/build/docs/optimize-builds/building-leaner-containers
- Using a cache like Kaniko with your build to cache container build artifacts .Kaniko works with all major cloud container registry. Reference – https://github.com/GoogleContainerTools/kaniko
- Selective deployment based on last run and changes – Reference – https://cloud.google.com/blog/products/infrastructure-modernization/multi-folder-infrastructure-as-code-optimization
- Exclude files not required by build using vendor supported .ignore files – Reference – ( For docker, refer to BuildKit and .dockerignore , Link – https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ )
- Move towards Green devOps – Understand the carbon impact of your builds and schedule – batch changes for build, leverage green regions and timelines.