【问题标题】:Deploying VueJS on google cloud在谷歌云上部署 VueJS
【发布时间】:2019-04-12 15:51:47
【问题描述】:

我正在使用 Vue CLI 3 创建一个具有以下预设的 Web 应用程序:babel、PWA、Vue Router 和 css 处理器。我正在尝试在 Google Cloud 的 App Engine 上部署应用程序。我该如何服务?谷歌上的教程说我只需要这样做:

gcloud app deploy

在根目录下,但是不知道怎么配置app.yaml来部署dist/文件夹。

【问题讨论】:

    标签: vue.js google-cloud-platform cloud web-deployment vue-cli-3


    【解决方案1】:

    您是否尝试过使用 Cloud Build 将 Vue.js 应用部署到 Google App Engine?我以这种方式部署任何 Vue.js 应用程序都没有问题。尝试按照complete instructions.的本教程进行操作

    基本上,在通过 Cloud Build 将 Vue.js 应用部署到 Google App Engine 时,您必须在项目根目录中包含以下两个文件:

    1. App.yaml

    runtime: nodejs10
    handlers:
      # Serve all static files with urls ending with a file extension
    - url: /(.*\..+)$ 
      static_files: dist/\1
      upload: dist/(.*\..+)$
      # catch all handler to index.html
    - url: /.*
      static_files: dist/index.html
      upload: dist/index.html

    1. cloudbuild.yaml

    steps:
    - name: node:10.15.1
      entrypoint: npm
      args: ["install"]
    - name: node:10.15.1
      entrypoint: npm
      args: ["run", "build"]
    - name: "gcr.io/cloud-builders/gcloud"
      args: ["app", "deploy"]
    timeout: "1600s"

    如果您不使用云构建,您可以参考上面的 app.yaml,配置应该足以满足您的情况。

    【讨论】:

    • 请不要只写链接答案。
    • @highfivebrian 显示状态步骤失败名称 gcr.io/cloud-builders/gcloud
    猜你喜欢
    • 2018-10-05
    • 2014-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-14
    • 1970-01-01
    相关资源
    最近更新 更多