Skip to content

Fix broken overrideCommand config #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/spec-node/singleContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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',
Expand Down