{GCP Cloud Run}システム パッケージのチュートリアルを使用する

 

https://cloud.google.com/run/docs/tutorials/system-packages?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 を有効化

gcloud services list --enabled
gcloud services list --available

 

gcloud services enable run.googleapis.com \
--project project01-9999999

 

-- 3. サンプルコードを取得する
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git

cd nodejs-docs-samples/run/system-package/

-- 4. コードの配布

gcloud builds submit --tag gcr.io/project01-9999999/graphviz

gcloud iam service-accounts create sa123

gcloud run deploy graphviz-web \
--service-account sa123@project01-9999999.iam.gserviceaccount.com  \
--image gcr.io/project01-9999999/graphviz


-- 5. 動作確認


https://graphviz-web-1111111111-an.a.run.app/diagram.png?dot=digraph Run { rankdir=LR Code -> Build -> Deploy -> Run }

 


-- 6. クリーンアップ

 

gcloud projects list

gcloud projects delete project01-9999999 \
--quiet