From c80a97fd02bf6e233b4ac17bc189ddbbb95e4193 Mon Sep 17 00:00:00 2001 From: William Phetsinorath Date: Thu, 19 Dec 2024 21:35:19 +0000 Subject: [PATCH] Fix broken overrideCommand config --- src/spec-node/singleContainer.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/spec-node/singleContainer.ts b/src/spec-node/singleContainer.ts index 9b0783443..fe5fa847c 100644 --- a/src/spec-node/singleContainer.ts +++ b/src/spec-node/singleContainer.ts @@ -196,7 +196,7 @@ async function buildAndExtendImage(buildParams: DockerResolverParameters, config if (buildParams.buildxPush) { args.push('--push'); } else { - if (buildParams.buildxOutput) { + if (buildParams.buildxOutput) { args.push('--output', buildParams.buildxOutput); } else { args.push('--load'); // (short for --output=docker, i.e. load into normal 'docker images' collection) @@ -385,18 +385,12 @@ export async function spawnDevContainer(params: DockerResolverParameters, config ); const customEntrypoints = mergedConfig.entrypoints || []; - const entrypoint = ['--entrypoint', '/bin/sh']; - const cmd = ['-c', `echo Container started + const entrypoint = typeof typeof mergedConfig.overrideCommand === 'boolean' && !mergedConfig.overrideCommand ? [] : ['--entrypoint', '/bin/sh']; + const cmd = typeof mergedConfig.overrideCommand === 'boolean' && !mergedConfig.overrideCommand ? [] : ['-c', `echo Container started trap "exit 0" 15 ${customEntrypoints.join('\n')} exec "$@" while sleep 1 & wait $!; do :; done`, '-']; // `wait $!` allows for the `trap` to run (synchronous `sleep` would not). - const overrideCommand = mergedConfig.overrideCommand; - if (overrideCommand === false && imageDetails) { - const details = await imageDetails(); - cmd.push(...details.Config.Entrypoint || []); - cmd.push(...details.Config.Cmd || []); - } const args = [ 'run',