has supported Google’s service over 12+ years - Orchestrates computing, networking, and storage infrastructure - Microservices Platform - GKE = Google Kubernetes Engine - Fully-managed version of Kubernetes on GCP
HTTP on $PORT // main.go package main // ... func main() { r := chi.NewRouter() r.Get("/", func(w http.ResponseWriter, r *http.Request) { m := &Message{ Status: http.StatusOK, Text: os.Getenv("MESSAGE"), } render.JSON(w, r, m) }) port := os.Getenv("PORT") if port == "" { port = "8080" } log.Fatal(http.ListenAndServe(":"+port, r)) } // ...
Dockerfile FROM golang:1.13 as go FROM gcr.io/distroless/base-debian10 as run FROM go as build WORKDIR /go/src/app COPY go.mod . COPY go.sum . RUN go mod download COPY . . RUN go build -o /go/bin/app FROM run COPY --from=build /go/bin/app /usr/local/bin/app CMD ["app"] $ docker image build … $ docker image push … $ docker container run …
- You can run any container listening http on $PORT - Cloud Run allows you to deploy containerized applications with a single command or a few clicks. - Cloud Run can use most of the GCP resources - API, Database, Storage … - More features are coming!