Deploying Go App with GCP, CircleCI, and Spinnaker
Introducing a deployment of the Go app using Google Cloud Platform, CircleCI, and Spinnaker.
--
This piece will focus on deploying a Go app with Continuous Delivery using Kubernetes, CircleCI, and Spinnaker. After finishing this piece, you can configure these services to automatically build and deploy it. When you modify the code, the changes trigger the pipeline to automatically rebuild and redeploy to production as a new version.
Prerequisites
Before reading this piece, you need to:
- Install Docker
- Install Go
Example repo
You can view the example code at:
Deployment Overview
The steps of deploying are as follows:
- A developer changes the code and pushes it.
- CircleCI detects the change, builds a docker image and pushes it to the registry (GCR)
- Spinnaker detects the new image automatically, flows through a pipeline and deploys the images to production.
Set up Go app
First off, we prepare a very simple Go app just responding to Hello Go App!
Create a main.go
:
Run it:
go run main.go
See it at http://localhost:8080
:
Next, we make this app Docker.
Create a DockerFile
:
FROM golang:1.13.3-alpineENV GO111MODULE=onWORKDIR /go/src/golang-deploy-gcp
COPY . .RUN go get -d -v ./...
RUN go install -v ./...