1import * as AWS from "@/AWS";
2import * as Effect from "effect/Effect";
3import * as HttpServerResponse from "effect/http/HttpServerResponse";
4
5/**
6 * Bundled-`main` fixture for the ECS local-dev conformance test: an inline
7 * Effect program bundled into a bun-based image (exercising the full
8 * bundle → generated Dockerfile → docker build → ECR push pipeline against
9 * the floci-emulated registry), serving a marker over HTTP.
10 *
11 * `networkMode: "bridge"` + an explicit `port` makes floci publish the
12 * literal host port on the Docker host, so the test can reach the container
13 * at `localhost:<port>` (awsvpc tasks are expose-only when floci itself
14 * runs in a container — no host binding to connect to from the test).
15 */
16export default class EcsDevMainTask extends AWS.ECS.Task<EcsDevMainTask>()(
17 "EcsDevMainTask",
18 {
19 main: import.meta.filename,
20 cpu: 256,
21 memory: 512,
22 port: 17357,
23 networkMode: "bridge",
24 requiresCompatibilities: ["EC2"],
25 // Docker Hub's `oven/bun` image (also the default); the public.ecr.aws
26 // mirrors rate-limit anonymous pulls during local builds.
27 image: "oven/bun:1",
28 // Build for the host architecture — the emulator runs the container on
29 // this machine, so a cross-arch image would need qemu emulation.
30 runtimePlatform:
31 process.arch === "arm64"
32 ? { cpuArchitecture: "ARM64", operatingSystemFamily: "LINUX" }
33 : { cpuArchitecture: "X86_64", operatingSystemFamily: "LINUX" },
34 },
35 Effect.gen(function* () {
36 return {
37 fetch: Effect.gen(function* () {
38 return HttpServerResponse.text("ecs-dev-main-marker");
39 }),
40 };
41 }),
42) {}