( projectDir: string, outputPath: string, options: RenderOptions, )
| 1236 | // `pageNavigationTimeoutMs` to the options forwarded to `buildDockerRunArgs`. |
| 1237 | // fallow-ignore-next-line complexity |
| 1238 | async function renderDocker( |
| 1239 | projectDir: string, |
| 1240 | outputPath: string, |
| 1241 | options: RenderOptions, |
| 1242 | ): Promise<SingleRenderResult> { |
| 1243 | const startTime = Date.now(); |
| 1244 | |
| 1245 | // Dev mode (tsx/ts-node) uses "latest" since the local version isn't on npm |
| 1246 | const dockerVersion = isDevMode() ? "latest" : VERSION; |
| 1247 | if (!options.quiet && isDevMode()) { |
| 1248 | console.log(c.dim(" Dev mode: using hyperframes@latest in Docker image")); |
| 1249 | } |
| 1250 | |
| 1251 | const platform = resolveDockerHostPlatform(options); |
| 1252 | |
| 1253 | let imageTag: string; |
| 1254 | try { |
| 1255 | imageTag = ensureDockerImage(dockerVersion, platform, options.quiet); |
| 1256 | } catch (error: unknown) { |
| 1257 | const message = normalizeErrorMessage(error); |
| 1258 | const isDockerMissing = /connect|not found|ENOENT/i.test(message); |
| 1259 | errorBox( |
| 1260 | isDockerMissing ? "Docker not available" : "Docker image build failed", |
| 1261 | message, |
| 1262 | isDockerMissing |
| 1263 | ? "Install Docker: https://docs.docker.com/get-docker/" |
| 1264 | : "Check Docker is running: docker info", |
| 1265 | ); |
| 1266 | process.exit(1); |
| 1267 | } |
| 1268 | |
| 1269 | const outputDir = dirname(outputPath); |
| 1270 | const outputFilename = basename(outputPath); |
| 1271 | const dockerArgs = buildDockerRunArgs({ |
| 1272 | imageTag, |
| 1273 | projectDir: resolve(projectDir), |
| 1274 | outputDir: resolve(outputDir), |
| 1275 | outputFilename, |
| 1276 | platform, |
| 1277 | options: { |
| 1278 | fps: options.fps, |
| 1279 | quality: options.quality, |
| 1280 | format: options.format, |
| 1281 | gifLoop: options.gifLoop, |
| 1282 | workers: options.workers, |
| 1283 | gpu: options.gpu, |
| 1284 | browserGpu: options.browserGpuMode === "hardware", |
| 1285 | hdrMode: options.hdrMode, |
| 1286 | crf: options.crf, |
| 1287 | vp9CpuUsed: options.vp9CpuUsed, |
| 1288 | videoBitrate: options.videoBitrate, |
| 1289 | videoFrameFormat: options.videoFrameFormat, |
| 1290 | quiet: options.quiet, |
| 1291 | variables: options.variables, |
| 1292 | entryFile: options.entryFile, |
| 1293 | outputResolution: options.outputResolution, |
| 1294 | pageSideCompositing: options.pageSideCompositing, |
| 1295 | debug: options.debug, |
no test coverage detected