mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
feat: custom docker entrypoint (#7097)
This commit is contained in:
@@ -125,3 +125,76 @@ test('ConvertGpusWithQuotes', function () {
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointSimple', function () {
|
||||
$input = '--entrypoint /bin/sh';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => '/bin/sh',
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointWithEquals', function () {
|
||||
$input = '--entrypoint=/bin/bash';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => '/bin/bash',
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointWithArguments', function () {
|
||||
$input = '--entrypoint "sh -c npm install"';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => 'sh -c npm install',
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointWithSingleQuotes', function () {
|
||||
$input = "--entrypoint 'memcached -m 256'";
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => 'memcached -m 256',
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointWithOtherOptions', function () {
|
||||
$input = '--entrypoint /bin/bash --cap-add SYS_ADMIN --privileged';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toHaveKeys(['entrypoint', 'cap_add', 'privileged'])
|
||||
->and($output['entrypoint'])->toBe('/bin/bash')
|
||||
->and($output['cap_add'])->toBe(['SYS_ADMIN'])
|
||||
->and($output['privileged'])->toBe(true);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointComplex', function () {
|
||||
$input = '--entrypoint "sh -c \'npm install && npm start\'"';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => "sh -c 'npm install && npm start'",
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointWithEscapedDoubleQuotes', function () {
|
||||
$input = '--entrypoint "python -c \"print(\'hi\')\""';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => "python -c \"print('hi')\"",
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointWithEscapedSingleQuotesInDoubleQuotes', function () {
|
||||
$input = '--entrypoint "sh -c \"echo \'hello\'\""';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => "sh -c \"echo 'hello'\"",
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertEntrypointSingleQuotedWithDoubleQuotesInside', function () {
|
||||
$input = '--entrypoint \'python -c "print(\"hi\")"\'';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'entrypoint' => 'python -c "print(\"hi\")"',
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user