MCPcopy
hub / github.com/KeygraphHQ/shannon / ensureImage

Function ensureImage

apps/cli/src/docker.ts:113–133  ·  view source on GitHub ↗
(version: string)

Source from the content-addressed store, hash-verified

111 * Local mode: auto-builds if missing. NPX mode: pulls from Docker Hub.
112 */
113export function ensureImage(version: string): void {
114 const image = getWorkerImage(version);
115 const exists = runQuiet('docker', ['image', 'inspect', image]);
116 if (exists) return;
117
118 if (getMode() === 'local') {
119 console.log('Worker image not found, building...');
120 buildImage(false);
121 } else {
122 console.log(`Pulling ${image}...`);
123 try {
124 execFileSync('docker', ['pull', image], { stdio: 'inherit' });
125 } catch {
126 console.error(`\nERROR: Failed to pull ${image}`);
127 console.error('The image may not be available for your platform yet.');
128 console.error('Check https://hub.docker.com/r/keygraph/shannon for available tags.');
129 process.exit(1);
130 }
131 pruneOldImages(version);
132 }
133}
134
135/**
136 * Detect if --add-host is needed (Linux without Podman).

Callers 1

startFunction · 0.85

Calls 6

getWorkerImageFunction · 0.85
runQuietFunction · 0.85
getModeFunction · 0.85
buildImageFunction · 0.85
pruneOldImagesFunction · 0.85
errorMethod · 0.65

Tested by

no test coverage detected