| 431 | } |
| 432 | |
| 433 | function writeCloudBuildConfig(image: string): string { |
| 434 | const cfgPath = join(stateDir(), "cloudrun-cloudbuild.yaml"); |
| 435 | mkdirSync(stateDir(), { recursive: true }); |
| 436 | // The build context (passed to `gcloud builds submit` as the repo root) is |
| 437 | // referenced as "." inside the config; the Dockerfile path is relative to |
| 438 | // that context. |
| 439 | writeFileSync( |
| 440 | cfgPath, |
| 441 | [ |
| 442 | "steps:", |
| 443 | "- name: gcr.io/cloud-builders/docker", |
| 444 | ` args: ["build","-f","packages/gcp-cloud-run/Dockerfile","-t","${image}","."]`, |
| 445 | `images: ["${image}"]`, |
| 446 | "timeout: 3600s", |
| 447 | "", |
| 448 | ].join("\n"), |
| 449 | ); |
| 450 | return cfgPath; |
| 451 | } |
| 452 | |
| 453 | // ── sites create ────────────────────────────────────────────────────────── |
| 454 | |