Created
April 6, 2019 04:06
-
-
Save vanduc1102/d9a9d8ae48d5eacacb45a9e193fd6e11 to your computer and use it in GitHub Desktop.
cloudbuild.yaml file example for deploying ReactJS project on Cloud Storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is script for https://cloud.google.com/cloud-build/ | |
steps: | |
# Install | |
- name: 'gcr.io/cloud-builders/yarn' | |
args: ['install'] | |
# Lint | |
- name: 'gcr.io/cloud-builders/yarn' | |
args: ['run', 'lint'] | |
# Test | |
- name: 'gcr.io/cloud-builders/yarn' | |
args: ['run', 'unittest'] | |
# Build | |
- name: 'gcr.io/cloud-builders/yarn' | |
args: ['run', 'build'] | |
env: | |
- 'REACT_APP_BACKEND_URL=${_REACT_APP_BACKEND_URL}' | |
- 'NODE_PATH=./src' | |
# Deploy | |
- name: gcr.io/cloud-builders/gsutil | |
args: ["-m", "rsync", "-d", "-r", "build", "gs://${_FE_STAGING_BUCKET_NAME}"] | |
# Grant public permission | |
# TODO: it should be remove, by setting default permissions for the bucket. | |
- name: gcr.io/cloud-builders/gsutil | |
args: ["-m", "acl", "ch", "-u", "AllUsers:R", "gs://${_FE_STAGING_BUCKET_NAME}/**"] |
gcloud builds submit --config cloudbuild-staging.yaml .
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
push build command from local: