codecamp

Micronaut Google Cloud Run

要部署到 Google Cloud Run,我们建议使用 JIB 来容器化您的应用程序。

使用 CLI

使用 JIB 创建应用程序:

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

或者使用 Micronaut Launch

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

使用 JIB 设置将您的应用程序部署到 Google Container Registry,运行:

$ ./gradlew jib

您现在已准备好部署您的应用程序:

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

其中 ​[PROJECT ID]​ 是您的项目 ID。系统会要求您指定区域,并会看到如下输出:

Service name: (example):
Deploying container to Cloud Run service [example] in project [PROJECT_ID] region [us-central1]

✓ Deploying... Done.
  ✓ Creating Revision...
  ✓ Routing traffic...
  ✓ Setting IAM Policy...
Done.
Service [example] revision [example-00004] has been deployed and is serving 100 percent of traffic at https://example-9487r97234-uc.a.run.app

URL 是您的 Cloud Run 应用程序的 URL。


Micronaut Google Cloud Function
Micronaut Azure Function
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

Micronaut 独立命令行应用程序

Micronaut 安全

Micronaut 多租户

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }