在Google Cloud Build中上载build文件夹 [英] Upload build folder in Google Cloud Build

查看:114
本文介绍了在Google Cloud Build中上载build文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用Cloud Build将我的React应用程序上传到App Engine,但它会上传所有源文件.是否只能使用Cloud Build管道部署build文件夹?

I'm trying to upload my React app to App Engine using Cloud Build but it upload all source files. Is it possible to only deploy the build folder using Cloud Build pipeline?

当前管道:

steps:
# Install
- name: 'gcr.io/cloud-builders/npm'
  args: ['install']
# Build
- name: 'gcr.io/cloud-builders/npm'
  args: ['run', 'build']
# Deploy
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy"]
  timeout: "1600s"

推荐答案

我假设您只想部署Build文件夹,而不要在App Engine上上传其他文件.我认为您只有静态文件,而app.yaml必须仅描述如何提供这些静态资源.

I assume that you want to only deploy the Build folder and not to upload the others file on App Engine. I think you only have statics file and your app.yaml must only describe how to serve these statics resources.

如果是这样,您可以这样做

If so, you can do like this

# Deploy
- name: "gcr.io/cloud-builders/gcloud"
  entrypoint: bash
  args: 
    - "-c"
    - |
        cp app.yaml ./build
        cd build
        gcloud app deploy
  timeout: "1600s"

这是一种解决方案;其他存在.而且,由于部署目录中不再存在构建目录,因此您必须更新app.yaml文件.

It's one solution; others exist. And you should have to update the app.yaml file because the build directory no longer exists in the deployment.

这篇关于在Google Cloud Build中上载build文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆