(input: DockerRunArgsInput)
| 96 | // this PR added one more conditional for --browser-timeout. |
| 97 | // fallow-ignore-next-line complexity |
| 98 | export function buildDockerRunArgs(input: DockerRunArgsInput): string[] { |
| 99 | const { imageTag, projectDir, outputDir, outputFilename, options } = input; |
| 100 | const platform = input.platform ?? resolveDockerPlatform(); |
| 101 | return [ |
| 102 | "run", |
| 103 | "--rm", |
| 104 | "--platform", |
| 105 | platform, |
| 106 | "--shm-size=2g", |
| 107 | // GPU encoding requires host GPU passthrough. |
| 108 | ...(options.gpu ? ["--gpus", "all"] : []), |
| 109 | "-v", |
| 110 | `${projectDir}:/project:ro`, |
| 111 | "-v", |
| 112 | `${outputDir}:/output`, |
| 113 | // Keep debug artifacts on the mounted host output path. The producer roots |
| 114 | // `.debug` at dirname(PRODUCER_RENDERS_DIR), so `/output/renders` maps to |
| 115 | // `/output/.debug/<job id>` instead of a disposable container path. |
| 116 | ...(options.debug ? ["-e", "PRODUCER_RENDERS_DIR=/output/renders"] : []), |
| 117 | imageTag, |
| 118 | "/project", |
| 119 | "--output", |
| 120 | `/output/${outputFilename}`, |
| 121 | "--fps", |
| 122 | fpsToFfmpegArg(options.fps), |
| 123 | "--quality", |
| 124 | options.quality, |
| 125 | "--format", |
| 126 | options.format, |
| 127 | ...(options.gifLoop != null ? ["--gif-loop", String(options.gifLoop)] : []), |
| 128 | ...(options.workers != null ? ["--workers", String(options.workers)] : []), |
| 129 | ...(options.crf != null ? ["--crf", String(options.crf)] : []), |
| 130 | ...(options.vp9CpuUsed != null ? ["--vp9-cpu-used", String(options.vp9CpuUsed)] : []), |
| 131 | ...(options.videoBitrate ? ["--video-bitrate", options.videoBitrate] : []), |
| 132 | ...(options.videoFrameFormat && options.videoFrameFormat !== "auto" |
| 133 | ? ["--video-frame-format", options.videoFrameFormat] |
| 134 | : []), |
| 135 | ...(options.quiet ? ["--quiet"] : []), |
| 136 | ...(options.debug ? ["--debug"] : []), |
| 137 | ...(options.gpu ? ["--gpu"] : []), |
| 138 | ...(options.browserGpu ? [] : ["--no-browser-gpu"]), |
| 139 | ...(options.hdrMode === "force-hdr" ? ["--hdr"] : []), |
| 140 | ...(options.hdrMode === "force-sdr" ? ["--sdr"] : []), |
| 141 | ...(options.variables && Object.keys(options.variables).length > 0 |
| 142 | ? ["--variables", JSON.stringify(options.variables)] |
| 143 | : []), |
| 144 | ...(options.entryFile ? ["--composition", options.entryFile] : []), |
| 145 | ...(options.outputResolution ? ["--resolution", options.outputResolution] : []), |
| 146 | ...(options.pageSideCompositing === false ? ["--no-page-side-compositing"] : []), |
| 147 | ...(options.pageNavigationTimeoutMs != null |
| 148 | ? ["--browser-timeout", String(options.pageNavigationTimeoutMs / 1000)] |
| 149 | : []), |
| 150 | ]; |
| 151 | } |
no test coverage detected