1
0
Fork 0
mirror of synced 2024-05-21 05:02:37 +12:00

Added Deno functions env

This commit is contained in:
Eldad Fux 2020-07-19 17:43:59 +03:00
parent 4950666caf
commit ada7816148
5 changed files with 30 additions and 3 deletions

View file

@ -29,6 +29,13 @@ return [
'image' => 'appwrite/env-python:3.8',
'logo' => 'python.png',
],
'deno-1.2' => [
'name' => 'Deno',
'version' => '1.2',
'base' => 'hayd/deno:alpine-1.2.0',
'image' => 'appwrite/env-deno:1.2',
'logo' => 'deno.png',
],
// 'dart-2.8' => [
// 'name' => 'Dart',
// 'version' => '2.8',

View file

@ -7,6 +7,7 @@ use Appwrite\Database\Database;
use Appwrite\Database\Adapter\MySQL as MySQLAdapter;
use Appwrite\Database\Adapter\Redis as RedisAdapter;
use Appwrite\Database\Validator\Authorization;
use Utopia\App;
use Utopia\CLI\Console;
use Utopia\Config\Config;
@ -265,6 +266,7 @@ class FunctionsV1
$exitCode = Console::execute("docker run \
-d \
--entrypoint=\"\" \
--cpus=4 \
--memory=128m \
--memory-swap=128m \
@ -278,7 +280,7 @@ class FunctionsV1
{$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'"
, null, $stdout, $stderr, 30);
$executionEnd = \microtime(true);
if($exitCode !== 0) {
@ -297,7 +299,7 @@ class FunctionsV1
$executionStart = \microtime(true);
$exitCode = Console::execute("docker exec {$container} {$command}"
, null, $stdout, $stderr, $function->getAttribute('timeout', 900)); // TODO add app env for max timeout
, null, $stdout, $stderr, $function->getAttribute('timeout', (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900))); // TODO add app env for max timeout
$executionEnd = \microtime(true);
@ -322,7 +324,7 @@ class FunctionsV1
Console::success(count($list).' running containers counted');
$max = 10;
$max = (int) App::getEnv('_APP_FUNCTIONS_CONTAINERS');
if(count($list) > $max) {
Console::info('Starting containers cleanup');

View file

@ -0,0 +1,11 @@
FROM hayd/deno:alpine-1.2.0
LABEL maintainer="team@appwrite.io"
RUN apk add tar
RUN mkdir /usr/local/src
WORKDIR /usr/local/src/
ENV DENO_DIR=/usr/local/src/.appwrite

View file

@ -0,0 +1,7 @@
echo 'Starting Deno 1.2 build...'
docker build --tag appwrite/env-deno:1.2 .
echo 'Pushing Deno 1.2 build to registry...'
docker push appwrite/env-deno:1.2

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB