mattesj
mattesj

Reputation: 609

Upload build folder in Google Cloud 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?

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"

Upvotes: 4

Views: 1629

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75715

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.

Upvotes: 4

Related Questions