Deploying an application

Deploying a Cloud Run application

To deploy your application to Cloud Run:

  1. Choose the Cloud Run: Deploy command using the Cloud Code status bar.

    This brings up the Cloud Run Deployment UI. Cloud Run: Deployment UI with pre-existing service selected

  2. Set your Google Cloud project.

  3. Select a preexisting service or create a new one.

  4. If you're creating a new service, choose your platform preferences under 'Deployment Platform', either 'Cloud Run (fully managed)' or 'Cloud Run for Anthos'. Refer to the Choosing your platform guide if you need help deciding which option if best for your development needs.

    • If you select 'Cloud Run (fully managed)', choose a region to deploy to.
    • If you select 'Cloud Run for Anthos', configure the Kubernetes cluster information (the cluster must have Anthos support enabled).
  5. You can also specify additional settings like service account, environment variables, and SQL connections, using the Advanced revision settings section.

    The following environment variables are automatically added to the running containers:

    Name Description Example
    PORT The port your HTTP server should listen on. 8080
    K_SERVICE The name of the Cloud Run service being run. hello-world
    K_REVISION The name of the Cloud Run revision being run. hello-world.1
    K_CONFIGURATION The name of the Cloud Run configuration that created the revision. hello-world

  6. Specify your builder (Docker or Buildpack) and its settings.

  7. After you define your preferred settings, you can click 'Deploy'.

    Cloud Code then builds your image, pushes it to the registry, and deploys your app to Cloud Run. Your application is now live!

  8. View your running app by following the URL displayed in the webview.

    URL of the running app displayed in Deploy to Cloud Run UI

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.