86 lines · 3.2 KB
/**
 * Cloud runner sizes. Each size is its own Container-backed Durable Object class because a Container's
 * instance type is fixed per class; larger sizes are charged proportionally more Container minutes.
 *
 * Every size has a Docker-in-Docker twin on the same instance type, built from `runner/Dockerfile.dind`. Jobs
 * that use Docker actions move to the twin at compile time (`withDockerRunner`); everything else stays on the
 * lighter image. A twin bills exactly like its base size: same instance type, same weight, same meter.
 */
export type RunnerBinding =
  | "RUNNER"
  | "RUNNER_LARGE"
  | "RUNNER_XLARGE"
  | "RUNNER_DIND"
  | "RUNNER_LARGE_DIND"
  | "RUNNER_XLARGE_DIND";

type BaseBinding = "RUNNER" | "RUNNER_LARGE" | "RUNNER_XLARGE";

type RunnerSize = {
  binding: RunnerBinding;
  /** The size this one bills as (itself for base sizes). */
  base: BaseBinding;
  labels: string[];
  weight: number;
  docker: boolean;
  description: string;
};

const BASE_SIZES: Array<{ binding: BaseBinding; labels: string[]; weight: number; description: string }> = [
  { binding: "RUNNER", labels: ["cloudflare", "ubuntu-latest"], weight: 1, description: "standard-1: 1/2 vCPU, 4 GiB" },
  {
    binding: "RUNNER_LARGE",
    labels: ["cloudflare-large", "ubuntu-latest-4-cores"],
    weight: 2,
    description: "standard-2: 1 vCPU, 6 GiB",
  },
  {
    binding: "RUNNER_XLARGE",
    labels: ["cloudflare-xlarge", "ubuntu-latest-8-cores"],
    weight: 4,