https://cloud.google.com/run/docs/tutorials/system-packages?hl=ja
https://cloud.google.com/sdk/gcloud/reference/run/deploy
https://cloud.google.com/run/docs/managing/revisions?hl=ja
https://cloud.google.com/run/docs/rollouts-rollbacks-traffic-migration?hl=ja
-- 1. 前作業
gcloud init
gcloud auth list
gcloud --version
gcloud projects create project01-9999999 \
--name="project01"
gcloud config list
gcloud config set project project01-9999999
gcloud config set compute/region asia-northeast1 --quiet
gcloud config set run/region asia-northeast1 --quiet
gcloud config set compute/zone asia-northeast1-a --quiet
gcloud beta billing accounts list
gcloud beta billing projects link project01-9999999 --billing-account=111111-111111-111111
gcloud services enable compute.googleapis.com --project project01-9999999
gcloud components update
-- 2. Cloud Run Admin API,Cloud Build API を有効化
gcloud services list --enabled
gcloud services enable run.googleapis.com \
--project project01-9999999
gcloud services enable cloudbuild.googleapis.com \
--project project01-9999999
-- 3. サンプルコードを取得する
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
cd nodejs-docs-samples/run/system-package/
vi Dockerfile
ttf-ubuntu-font-family 削除
-- 4. コードの配布(1回目)
gcloud builds submit --tag gcr.io/project01-9999999/graphviz-1
gcloud iam service-accounts create sa99999999
gcloud run deploy graphviz-web \
--service-account sa99999999@project01-9999999.iam.gserviceaccount.com \
--image gcr.io/project01-9999999/graphviz-1
-- 5. コードの配布(2回目)
gcloud builds submit --tag gcr.io/project01-9999999/graphviz-2
gcloud run deploy graphviz-web \
--service-account sa99999999@project01-9999999.iam.gserviceaccount.com \
--image gcr.io/project01-9999999/graphviz-2 \
--concurrency=1 \
--max-instances=1 \
--min-instances=0 \
--no-traffic
-- 6. サービスのリビジョンのリストを表示する
gcloud run services list
gcloud run revisions list \
--service graphviz-web \
--region asia-northeast1
gcloud run revisions describe graphviz-web-00001-hjz \
--region asia-northeast1
gcloud run revisions describe graphviz-web-00002-zg2 \
--region asia-northeast1
-- 7. 複数のリビジョン間でトラフィックを分割する
gcloud run services update-traffic graphviz-web \
--to-revisions graphviz-web-00001-hjz=75,graphviz-web-00002-zg2=25
gcloud run services describe graphviz-web \
--region asia-northeast1 \
--format yaml
-- 8. クリーンアップ
gcloud projects list
gcloud projects delete project01-9999999 \
--quiet
gcloud beta billing projects unlink project01-9999999