在谷歌云上部署VueJS

问题描述 投票:1回答:1

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

gcloud app deploy

在根目录中,但我不知道如何配置app.yaml来部署dist /文件夹。

vue.js google-cloud-platform cloud web-deployment vue-cli-3
1个回答
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,配置应该足以满足您的需求。

© www.soinside.com 2019 - 2024. All rights reserved.