22
Template repository for starting a project on Go + Docker + Google cloud stack
source link: https://github.com/ashishb/golang-template-repo
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
GoLang + Docker + Google Cloud Run template repository
Basic development
- Init using your preferred GoLang module name, for example,
make init NAME=github.com/ashishb/golang-template-repo
- Write the code in
src/
- Format it using
make format
- Lint it using
make lint
- Build it using
make build
. If required, clean it usingmake clean
- If you have written any tests then test using
make test
- Run using
make run
- Note: If you are on Mac OS, you can explicitly build for 64-bit GNU/Linux using
make build_linux
Docker
make docker_build make docker_run
Google cloud run deployment
- Create a new project on Google Cloud
- Put the project ID (not project name) in
GOOGLE_CLOUD_PROJECT_NAME
variable in Makefile - Create a new Cloud run service at https://console.cloud.google.com/run
- Put the cloud run service name in
GOOGLE_CLOUD_RUN_SERVICE_NAME
variable in Makefile - Install google-cloud-sdk
- Run
docker_gcr_login
. This is only required only once on your Google Cloud SDK installation - Now, push your local image to Google Cloud registry using
make docker_gcr_push
- And deploy the image using
make gcr_deploy
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK