I would like to deploy an application to Google Kubernetes Engine(GKE) but I confused between (1) pull a new commit from a master branch from git server inside a container (2) pull a new image that's included new commit from docker hub
Which is the best solution for cost and performance?
If you're hosting code on GitHub/Bitbucket, consider just using Google Container Builder to trigger a new build on every commit and build/push the docker image and deploy it to GKE.
If you're not on github, you can use something like GitOps https://www.weave.works/blog/gitops-high-velocity-cicd-for-kubernetes.
You can use Github Actions, Gitlab CICD or Bitbucket for setting up a CICD pipeline.
For example, Gitlab connects with your GKE using OAuth and gives you the ability to build, test, lint, review and deploy in different environments.
If you want to explore more on how to use Gitlab CICD to Deploy a mono-repo of microservices consider reading https://medium.com/@arslan_53972/application-deployment-using-gitlab-ci-cd-on-managed-kubernetes-cluster-at-gcp-72b59496979c