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

Function bootSelfhostDocker

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

Source from the content-addressed store, hash-verified

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

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