Automate Cloud Run deployment in a minute

  1. Run Go locally
  2. Run Go on Google Cloud Run
  1. Running Go locally -:
+-- Dockerfile
+-- docker-compose.yml
+-- app
| +-- app.go
FROM golang:1.10COPY ./app /go/src/
WORKDIR /go/src/
RUN go get -u && go get ./RUN go buildCMD go get && \
fresh; \
version: '2'
container_name: golang.go
build: ./
- VIRTUAL_HOST=custom.pv
- APP_ENV=dev
- ./app:/go/src/
- "5000:8080"
package mainimport (
func regRoutes(routes *gin.Engine) { routes.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"status": "up",
})}func main() { routes := gin.Default()
routes.Run() // run in 8080 port
components install beta --quiet gcloud auth configure-docker
docker build -t golangcloudrun:latest .docker tag  golangcloudrun:latest${{ secrets.GCLOUD_PROJECT_ID }}/golangcloudrun docker push${{ secrets.GCLOUD_PROJECT_ID }}/golangcloudrun:latest 
** components install beta --quiet **** gcloud beta run deploy ${CLOUD_RUN_SERVICE_NAME} — image${{ GCLOUD_PROJECT_ID }}/golangcloudrun — platform managed — region us-central1 — project=${{ secrets.GCLOUD_PROJECT_ID }} **




Software Development Enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Passing a Parameter through an ICommand in Xamarin

NIST Digital Library of Mathematical Functions

GCP Cloud Run — Serverless Stateless Containers

Mocked backend in iOS applications

Pimsleur Vs Mondly — Best Review Of #1 Language Apps

E-fleet System

Busuu vs LinguaLift: Effectivity Of These 2 Apps

Scrapy: Background

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ujwal dhakal

ujwal dhakal

Software Development Enthusiast

More from Medium

Multi-Cloud SetUp: — RDS on AWS & GKE on GCP

Choosing Between GKE and Cloud Run

Cloud Run vs. GKE decision tree

-Datadog | Cloud Monitoring

Way to Lower Cloud SQL InstanceCost