Last active
February 17, 2025 01:17
-
-
Save Na0ki/3e61020c621d6f5c856718491050805f to your computer and use it in GitHub Desktop.
cloudbuildで静的アセットを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
| steps: | |
| - name: 'node:22.14.0' | |
| entrypoint: 'npm' | |
| args: ['install'] | |
| - name: 'node:22.14.0' | |
| entrypoint: 'npm' | |
| args: ['run', 'build:prod'] | |
| # Cloud Storageにアップロードする | |
| # cloudbuild.ymlにおけるartifacts/objectsでの指定だとgsutilが使われる上にrecursiveに対応できないため、 | |
| # recursiveも使えてgsutilよりもパフォーマンスが高いとされる `gcloud storage cp -R` を使うためにcloud-sdkを使ったステップで対応 | |
| # https://cloud.google.com/blog/products/storage-data-transfer/new-gcloud-storage-cli-for-your-data-transfers?hl=en | |
| - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim' | |
| entrypoint: 'gcloud' | |
| args: ['storage', 'cp', '-R', './dist/webpack', 'gs://[BUCKET_NAME]'] | |
| options: | |
| # https://cloud.google.com/build/docs/securing-builds/store-manage-build-logs?hl=ja | |
| logging: CLOUD_LOGGING_ONLY | |
| machineType: E2_HIGHCPU_32 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment