fix(functions): fix worker commands for windows
This commit is contained in:
parent
048def33b9
commit
e64f0f3c5e
|
@ -306,7 +306,7 @@ class FunctionsV1
|
|||
\array_walk($vars, function (&$value, $key) {
|
||||
$key = $this->filterEnvKey($key);
|
||||
$value = \escapeshellarg((empty($value)) ? 'null' : $value);
|
||||
$value = "\t\t\t--env {$key}={$value} \\";
|
||||
$value = "--env {$key}={$value}";
|
||||
});
|
||||
|
||||
$tagPath = $tag->getAttribute('path', '');
|
||||
|
@ -358,20 +358,20 @@ class FunctionsV1
|
|||
$executionStart = \microtime(true);
|
||||
$executionTime = \time();
|
||||
|
||||
$exitCode = Console::execute("docker run \
|
||||
-d \
|
||||
--entrypoint=\"\" \
|
||||
--cpus=".App::getEnv('_APP_FUNCTIONS_CPUS', '1')." \
|
||||
--memory=".App::getEnv('_APP_FUNCTIONS_MEMORY', '128')."m \
|
||||
--memory-swap=".App::getEnv('_APP_FUNCTIONS_MEMORY_SWAP', '128')."m \
|
||||
--name={$container} \
|
||||
--label appwrite-type=function \
|
||||
--label appwrite-created=".$executionTime." \
|
||||
--volume {$tagPathTargetDir}:/tmp:rw \
|
||||
--workdir /usr/local/src \
|
||||
".\implode("\n", $vars)."
|
||||
{$environment['image']} \
|
||||
sh -c 'mv /tmp/code.tar.gz /usr/local/src/code.tar.gz && tar -zxf /usr/local/src/code.tar.gz --strip 1 && rm /usr/local/src/code.tar.gz && tail -f /dev/null'"
|
||||
$exitCode = Console::execute("docker run ".
|
||||
" -d".
|
||||
" --entrypoint=\"\"".
|
||||
" --cpus=".App::getEnv('_APP_FUNCTIONS_CPUS', '1').
|
||||
" --memory=".App::getEnv('_APP_FUNCTIONS_MEMORY', '128')."m".
|
||||
" --memory-swap=".App::getEnv('_APP_FUNCTIONS_MEMORY_SWAP', '128')."m".
|
||||
" --name={$container}".
|
||||
" --label appwrite-type=function".
|
||||
" --label appwrite-created={$executionTime}".
|
||||
" --volume {$tagPathTargetDir}:/tmp:rw".
|
||||
" --workdir /usr/local/src".
|
||||
" ".\implode(" ", $vars).
|
||||
" {$environment['image']}".
|
||||
" sh -c 'mv /tmp/code.tar.gz /usr/local/src/code.tar.gz && tar -zxf /usr/local/src/code.tar.gz --strip 1 && rm /usr/local/src/code.tar.gz && tail -f /dev/null'"
|
||||
, '', $stdout, $stderr, 30);
|
||||
|
||||
$executionEnd = \microtime(true);
|
||||
|
@ -401,11 +401,8 @@ class FunctionsV1
|
|||
|
||||
$executionStart = \microtime(true);
|
||||
|
||||
$exitCode = Console::execute("docker exec \
|
||||
".\implode("\n", $vars)."
|
||||
{$container} \
|
||||
{$command}"
|
||||
, '', $stdout, $stderr, $function->getAttribute('timeout', (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)));
|
||||
$exitCode = Console::execute("docker exec ".\implode(" ", $vars)." {$container} {$command}"
|
||||
, '', $stdout, $stderr, $function->getAttribute('timeout', (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)));
|
||||
|
||||
$executionEnd = \microtime(true);
|
||||
$executionTime = ($executionEnd - $executionStart);
|
||||
|
|
Loading…
Reference in a new issue