MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / bootSelfhostDocker

Function bootSelfhostDocker

e2e/setup/selfhost-docker.boot.ts:145–171  ·  view source on GitHub ↗
(
  options: SelfhostDockerBootOptions,
)

Source from the content-addressed store, hash-verified

143};
144
145export const bootSelfhostDocker = async (
146 options: SelfhostDockerBootOptions,
147): Promise<BootedProcesses> => {
148 const image = await resolveImage(options.logFile);
149 const name = selfhostDockerContainerName(options.port);
150 const volume = selfhostDockerVolumeName(options.port);
151
152 // A previous suite that died without teardown leaves the named container
153 // and volume squatting — remove both for a hermetic boot.
154 await exec("docker", ["rm", "-f", name]).catch(() => {});
155 await exec("docker", ["volume", "rm", "-f", volume]).catch(() => {});
156
157 await runSelfhostContainer({ image, ...options });
158
159 // The target's restart() runs in a different process (test worker, not
160 // globalsetup) and must re-run the same image. claimPorts-style env
161 // publication: workers spawn after globalsetup, so they inherit this.
162 process.env.E2E_SELFHOST_DOCKER_RESOLVED_IMAGE = image;
163
164 return {
165 teardown: async () => {
166 await stopSelfhostContainer(options.port, options.logFile);
167 await exec("docker", ["volume", "rm", "-f", volume]).catch(() => {});
168 },
169 pids: [],
170 };
171};

Callers 1

setupFunction · 0.90

Calls 5

resolveImageFunction · 0.85
selfhostDockerVolumeNameFunction · 0.85
runSelfhostContainerFunction · 0.85
stopSelfhostContainerFunction · 0.85

Tested by

no test coverage detected