Upload build folder in Google Cloud Build

匆匆过客 提交于 2020-12-11 22:09:29

问题


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?

Current 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"

回答1:


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"

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.



来源:https://stackoverflow.com/questions/63202804/upload-build-folder-in-google-cloud-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!