All Projects → ashishb → golang-template-repo

ashishb / golang-template-repo

Licence: other
Template repository for starting a project on Go + Docker + Google cloud stack

Programming Languages

Makefile
30231 projects
go
31211 projects - #10 most used programming language
Dockerfile
14818 projects
HTML
75241 projects

GoLang + Docker + Google Cloud Run template repository Test Build docker image

Basic development

  1. Init using your preferred GoLang module name, for example, make init NAME=github.com/ashishb/golang-template-repo
  2. Write the code in src/
  3. Format it using make format
  4. Lint it using make lint
  5. Build it using make build. If required, clean it using make clean
  6. If you have written any tests then test using make test
  7. Run using make run
  8. Note: If you are on Mac OS, you can explicitly build for 64-bit GNU/Linux using make build_linux

Docker

  1. Build docker image using make docker_build
  2. Test using make docker_run

Google cloud run deployment

  1. Create a new project on Google Cloud
  2. Put the project ID (not project name) in GOOGLE_CLOUD_PROJECT_NAME variable in Makefile
  3. Create a new Cloud run service at https://console.cloud.google.com/run
  4. Put the cloud run service name in GOOGLE_CLOUD_RUN_SERVICE_NAME variable in Makefile
  5. Install google-cloud-sdk
  6. Run docker_gcr_login. This is only required only once on your Google Cloud SDK installation
  7. Now, push your local image to Google Cloud registry using make docker_gcr_push
  8. And deploy the image using make gcloud_deploy
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].