🌳
pt0/serverF/dockNameF.mts
1import { genContext } from './genContextF.mts'
2import { cliFlag } from './cliArgAI.mts'
7const flagToDockName: Record<string, string> = {'--withDocker': 'docker', '--withKaniko': 'kanikojob', '--withPodman': 'podman', '--withNix': 'nix'}
9const defaultDockName = () => {
10 const withDocker = cliFlag('--withDocker'), withKaniko = cliFlag('--withKaniko'), withPodman = cliFlag('--withPodman'), withNix = cliFlag('--withNix')
11 const builderFlagCount = [withDocker, withKaniko, withPodman, withNix].filter(Boolean).length
12 throwIf(() => builderFlagCount > 1)
13 if (withDocker) return 'docker'
14 if (withKaniko) return 'kanikojob'
15 if (withPodman) return 'podman'
16 const configured = flagToDockName[defaultDeployerFlag] || 'docker'
17 if (isOcWeb && configured === 'docker') { console.warn('OcWeb: overriding --withDocker default → kaniko'); return 'kanikojob' }
18 return configured
21export const getDockName = () => getDockBuildCtx().dockName
23export const getDockBuildCtx = () => dockBuildCtx.getStore() || {
24 dockName: defaultDockName()
27export const dockBuildCtx = genContext<{dockName: string}>()