1. 简介
欢迎参加 2025 年 Cloud Run 日活动!所有研讨会都将围绕“新闻”这一主题展开。
2. 设置 Google Cloud 环境
获取 Cloud 赠金
您需要声明包含 10 美元礼品卡赠金的结算账号,以便进行部署。请务必使用您的 Gmail 账号。
创建项目
- 在 Google Cloud 控制台的项目选择器页面上,选择或创建一个 Google Cloud 项目。建议:将其命名为“cloud-run-workshop”
- 确保您的 Cloud 项目已启用结算功能。了解如何检查项目是否已启用结算功能。
- 点击此链接以激活 Cloud Shell。
- 如需设置有效账号,请在 Cloud Shell 中运行以下命令:
gcloud config set account <ACCOUNT>
- 在 Cloud Shell 中运行以下命令,检查您的身份验证:
gcloud auth list
- 使用以下命令确认项目 ID:
gcloud config list project
- 设置项目 ID 变量。将 <YOUR_PROJECT_ID> 替换为上一步中的 ID:
export PROJECT_ID=<YOUR_PROJECT_ID> && gcloud config set project $PROJECT_ID
export REGION=europe-west1 && gcloud config set run/region $REGION
- 设置 Google API 密钥:
使用 https://aistudio.google.com/app/apikey 生成 API 密钥,然后将该密钥粘贴到此处:
export GOOGLE_API_KEY=PASTE_YOUR_ACTUAL_API_KEY_HERE
export GOOGLE_GENAI_USE_VERTEXAI=FALSE
- 启用必需的 API:
gcloud services enable cloudresourcemanager.googleapis.com \
servicenetworking.googleapis.com \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
aiplatform.googleapis.com \
compute.googleapis.com \
storage.googleapis.com
(这可能需要几分钟时间。)
克隆 Cloud Run Day 工作坊的代码示例
如需访问所有研讨会的示例代码,请克隆整个代码库:
git clone https://github.com/abhishekr700/Cloud-Run-Day-Workshop-2025.git