[英]Deploying a VueJs + Node app on App Engine w/ CloudBuild
My project is a VueJS frontend + Node Backend.我的项目是一个 VueJS 前端 + 节点后端。 The project is organized like this:
该项目是这样组织的:
/api (all the backend logic, like uploading to GCS)
package.json
/ui (all front end logic)
package.json
/config
cloudbuild.yaml
app.yaml
My specific issue is that when the project is built, only the vue-cli portion of the project is built and deployed.我的具体问题是,在项目构建时,只构建和部署了项目的 vue-cli 部分。 The Node logic is not.
节点逻辑不是。 What steps do I need to add to my cloudbuild or app.yaml files to ensure that the Node logic is being built and deployed along with the frontend code?
我需要向我的 cloudbuild 或 app.yaml 文件添加哪些步骤以确保 Node 逻辑与前端代码一起构建和部署?
Here is my cloudbuild.yaml file for reference这是我的 cloudbuild.yaml 文件以供参考
//cloudbuild.yaml
steps:
- name: gcr.io/cloud-builders/gcloud:latest
entrypoint: "ls"
args: ["-lah","/workspace"]
dir: "api"
- name: node
entrypoint: yarn
args: ["install"]
dir: "api"
- name: node
entrypoint: yarn
args: ['run', 'build']
dir: "api"
- name: node
entrypoint: yarn
args: ["install"]
dir: "ui"
- name: node
entrypoint: yarn
args: ['add', '@vue/cli']
dir: "ui"
- name: node
entrypoint: yarn
args: ['run', 'build']
dir: "ui"
- name: "gcr.io/cloud-builders/gcloud"
args: ["app", "deploy", "./app.yaml"]
timeout: "1600s"
Here is my app.yaml file for reference这是我的 app.yaml 文件以供参考
//app.yaml
runtime: nodejs14
service: icx-ui
handlers:
# Serve all static files with urls ending with a file extension
- url: /(.*\..+)$
static_files: ui/dist/\1
upload: ui/dist/(.*\..+)$
# catch all handler to index.html
- url: /.*
static_files: ui/dist/index.html
upload: ui/dist/index.html
Try to change the directory of your backend logic from ui
to api
:尝试将后端逻辑的目录从
ui
更改为api
:
from:从:
- name: node
entrypoint: yarn
args: ['run', 'build']
dir: "ui"
to:到:
- name: node
entrypoint: yarn
args: ['run', 'build']
dir: "api"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.