Containerize your code

To deploy to Cloud Run, you need to provide a container image. A container image is a packaging format that includes your code, its packages, any needed binary dependencies, the operating system to use, and anything else needed to run your service.

Dockerfile

A file named Dockerfile is commonly used to declare how to build the container image.

Dockerfiles very often start from a base image (e.g. FROM golang:1.11). You can find base images maintained by OS and language authors on Docker Hub. Cloud Build checks for cached images before pulling from Docker Hub. If you use a third-party build tool, you can configure your Docker daemon to check for images in the same cache. You can also find base images managed by Google in the Google Cloud Marketplace.

If you bring your own binaries, make sure they are compiled for Linux ABI x86_64.

These resources provide further information on Dockerfiles: