| 1 | import * as Cloudflare from "alchemy/Cloudflare"; |
| 2 | |
| 3 | /** |
| 4 | * Cloudflare-container twin of |
| 5 | * {@link import("./opencode-image.ts").OpencodeMicrovm}: the same Dockerfile |
| 6 | * shape (opencode server as the entrypoint), but Cloudflare boots the image |
| 7 | * from scratch on each cold start — there is no build-time memory snapshot — |
| 8 | * so opencode's process startup is inside every measured boot. |
| 9 | * |
| 10 | * Sized `standard-1` (1/2 vCPU, 4 GiB) — deliberately generous next to the |
| 11 | * MicroVM's 1 GiB, so a slower container boot can't be blamed on CPU/memory |
| 12 | * starvation at the `lite` tier. |
| 13 | */ |
| 14 | export class OpencodeContainer extends Cloudflare.Container<OpencodeContainer>()( |
| 15 | "BenchOpencodeContainer", |
| 16 | { |
| 17 | context: `${import.meta.dirname}/../contexts/opencode`, |
| 18 | maxInstances: 100, |
| 19 | instanceType: "standard-1", |
| 20 | instances: 0, |
| 21 | }, |
| 22 | ) {} |