9.3 Google Cloud Run

To deploy to Google Cloud Run we recommend using JIB to containerize your application.

Using the CLI

Creating an application with JIB:

  1. $ mn create-app my-app features jib

Or with Micronaut Launch

  1. $ curl https://launch.micronaut.io/example.zip\?features\=jib -o example.zip
  2. $ unzip example.zip -d example

With JIB setup to deploy your application to Google Container Registry, run:

  1. $ ./gradlew jib

You are now ready to deploy your application:

  1. $ gcloud run deploy --image gcr.io/[PROJECT ID]/example --platform=managed --allow-unauthenticated

Where [PROJECT ID] is your project ID. You will be asked to specify a region and will see output like the following:

  1. Service name: (example):
  2. Deploying container to Cloud Run service [example] in project [PROJECT_ID] region [us-central1]
  3. Deploying... Done.
  4. Creating Revision...
  5. Routing traffic...
  6. Setting IAM Policy...
  7. Done.
  8. Service [example] revision [example-00004] has been deployed and is serving 100 percent of traffic at https://example-9487r97234-uc.a.run.app

The URL is the URL of your Cloud Run application.