As builders work increasingly more with containers, it’s turning into more and more necessary to cut back the time to maneuver from supply code to a deployed software. To make constructing container photographs sooner and simpler, now we have constructed applied sciences like Cloud Build, ko, Jib, Nixery and added help for cloud-native Buildpacks. A few of these instruments focus particularly on constructing container photographs straight from the supply code with no Docker engine or a Dockerfile.

The Go programming language particularly makes constructing container photographs from supply code a lot simpler. This text focuses on how a instrument we developed named “ko” will help you deploy companies written in Go to Cloud Run sooner than Docker construct/push, and the way it compares to options like Buildpacks.

How does ko work?

ko is an open-source instrument developed at Google that helps you construct container photographs from Go applications and push them to container registries (together with Container Registry and Artifact Registry). ko does its job with out requiring you to jot down a Dockerfile and even set up Docker itself in your machine.

ko is spun off of the go-containerregistry library, which helps you work together with container registries and pictures. That is for motive: Nearly all of ko’s performance is carried out utilizing this Go module. Most notably that is what ko does:

  • Obtain a base picture from a container registry
  • Statically compile your Go binary
  • Create a brand new container picture layer with the Go binary
  • Append that layer to the bottom picture to create a brand new picture
  • Push the brand new picture to the distant container registry

Constructing and pushing a container picture from a Go program is kind of easy with ko:

Leave a Reply

Your email address will not be published. Required fields are marked *