| 1 | import * as Cloudflare from "@/Cloudflare"; |
| 2 | import * as pathe from "pathe"; |
| 3 | |
| 4 | /** |
| 5 | * The build context lives at a FIXED path under the suite's `.tmp` dir; the |
| 6 | * test materializes a Dockerfile + content there before deploying and |
| 7 | * rewrites the files live to drive hot reload. A fixed path (rather than a |
| 8 | * per-run temp clone) keeps the declaration static while the CONTENT stays |
| 9 | * fully test-controlled. |
| 10 | */ |
| 11 | export const RELOAD_CONTEXT_DIR = pathe.resolve( |
| 12 | import.meta.dirname, |
| 13 | "../../../../.tmp/container-reload-context", |
| 14 | ); |
| 15 | |
| 16 | /** Must match the port baked into the Dockerfile the test writes. */ |
| 17 | export const RELOAD_CONTAINER_PORT = 17362; |
| 18 | |
| 19 | /** |
| 20 | * User-supplied Dockerfile + build-context container (no `main`, no inline |
| 21 | * content): the variant whose files are invisible to `bun --watch`, so its |
| 22 | * hot reload rides the local worker runner's context watcher. |
| 23 | */ |
| 24 | export class ReloadContainer extends Cloudflare.Container<ReloadContainer>()( |
| 25 | "ReloadContainer", |
| 26 | { |
| 27 | context: RELOAD_CONTEXT_DIR, |
| 28 | observability: { logs: { enabled: true } }, |
| 29 | }, |
| 30 | ) {} |