Configure the OS only runtime

The OS only runtime is a language-independent, general-purpose runtime for Cloud Run source deployments. It includes the base Ubuntu operating system (OS) without any additional language-specific runtime components. The OS only runtime lets you deploy Go applications from source, and binaries such as Dart and Go. You can also deploy your own application images that you built from scratch using this runtime.

The OS only runtime is compatible with automatic base image updates for Cloud Run. This means your application automatically receives operating system-level security patches and updates, even when you don't use a specific supported language runtime.

Supported stack

The OS only runtime is available on the google-24 stack. For more information about the available OS only runtime versions, and the support schedule, see the Runtime lifecycle.

Compiled binaries

The OS only runtime lets you deploy pre-compiled binaries. You can also target a base image using a runtime alias. For example, to use the google-24/osonly24 base image, specify the alias, osonly24.

For compiled languages, make sure you build the binary targeting a Linux OS before you deploy. For example, to compile a Go application targeting linux/amd64, run the following command:

GOOS="linux" GOARCH=amd64 go build main.go

Deploy to Cloud Run

Deploy your service from source to Cloud Run using the gcloud beta run deploy command. Specify the base image (for example, osonly24) using any of the following deployment methods:

With build

To deploy a Go application from source with build to Cloud Run, run the following command:

gcloud beta run deploy SERVICE \
--source . \
--base-image=osonly24 \
--project PROJECT_ID \
--automatic-updates

Replace the following:

  • SERVICE: the name of your Cloud Run service.
  • PROJECT_ID: the Google Cloud project ID.

For more information on deploying from source with build, see Deploy services from source code.

Without build

To deploy from source to Cloud Run without using build, run the following command:

gcloud beta run deploy SERVICE \
--source . \
--no-build \
--base-image=osonly24 \
--project PROJECT_ID \
--command COMMAND

Replace the following:

  • SERVICE: the name of your Cloud Run service.
  • PROJECT_ID: the Google Cloud project ID.
  • COMMAND: the command that the container starts up with, for example, ./main.

For more information on deploying from source without build, see Deploy services from source code.