问题
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