diff --git a/app/config/environments.php b/app/config/environments.php index b9ce74d6e..94accd1c1 100644 --- a/app/config/environments.php +++ b/app/config/environments.php @@ -4,31 +4,36 @@ return [ 'node-14' => [ 'name' => 'Node.js', 'version' => '14.5', - 'image' => 'node:14.5-alpine', + 'base' => 'node:14.5-alpine', + 'image' => 'appwrite/env-node:14.5', 'logo' => 'node.png', ], 'php-7.4' => [ 'name' => 'PHP', 'version' => '7.4', - 'image' => 'php:7.4-cli-alpine', + 'base' => 'php:7.4-cli-alpine', + 'image' => 'appwrite/env-php:7.4', 'logo' => 'php.png', ], 'ruby-2.7' => [ 'name' => 'Ruby', 'version' => '2.7', - 'image' => 'ruby:2.7-alpine', + 'base' => 'ruby:2.7-alpine', + 'image' => 'appwrite/ruby-node:2.7', 'logo' => 'ruby.png', ], + 'python-3.8' => [ + 'name' => 'Python', + 'version' => '3.8', + 'base' => 'python:3.8-alpine', + 'image' => 'appwrite/env-python:3.8', + 'logo' => 'python.png', + ], // 'dart-2.8' => [ // 'name' => 'Dart', // 'version' => '2.8', - // 'image' => 'google/dart:2.8', + // 'base' => 'google/dart:2.8', + // 'image' => 'appwrite/env-dart:2.8', // 'logo' => 'dart.png', // ], - 'python-3.8' => [ - 'name' => 'Python', - 'version' => '3.8', - 'image' => 'python:3.8-alpine', - 'logo' => 'python.png', - ], ]; \ No newline at end of file diff --git a/app/workers/functions.php b/app/workers/functions.php index b2049fad5..b85398248 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -111,7 +111,7 @@ class FunctionsV1 --memory=50m \ --memory-swap=50m \ --rm \ - --name=appwrite-function- \ + --name=appwrite-function-{$functionId} \ --volume $(pwd):/app \ --workdir /app \ --env APPWRITE_FUNCTION_ID={$functionId} \ diff --git a/docker/environments/README.md b/docker/environments/README.md new file mode 100644 index 000000000..6ffaf1d4f --- /dev/null +++ b/docker/environments/README.md @@ -0,0 +1,5 @@ +# Appwrite Functions Environments + +Docker based enviornments for Appwrite Functions. You can use this Docker images to locally tests your functions by executing them on your local desktop or server. + +All the supported enviornments are based on Docker Alpine images. \ No newline at end of file diff --git a/docker/environments/node-14.5/Dockerfile b/docker/environments/node-14.5/Dockerfile new file mode 100644 index 000000000..ef625d3ce --- /dev/null +++ b/docker/environments/node-14.5/Dockerfile @@ -0,0 +1,5 @@ +FROM node:14.5-alpine + +LABEL maintainer="team@appwrite.io" + +RUN apk add tar \ No newline at end of file diff --git a/docker/environments/node-14.5/build.sh b/docker/environments/node-14.5/build.sh new file mode 100644 index 000000000..d81449f26 --- /dev/null +++ b/docker/environments/node-14.5/build.sh @@ -0,0 +1,7 @@ +echo 'Starting Node 14.5 build...' + +docker build --tag appwrite/env-node:14.5 . + +echo 'Pushing Node 14.5 build to registry...' + +docker push appwrite/env-node:14.5 \ No newline at end of file diff --git a/docker/environments/php-7.4/Dockerfile b/docker/environments/php-7.4/Dockerfile new file mode 100644 index 000000000..f23177451 --- /dev/null +++ b/docker/environments/php-7.4/Dockerfile @@ -0,0 +1,5 @@ +FROM php:7.4-cli-alpine + +LABEL maintainer="team@appwrite.io" + +RUN apk add tar \ No newline at end of file diff --git a/docker/environments/php-7.4/build.sh b/docker/environments/php-7.4/build.sh new file mode 100644 index 000000000..84b20e4d4 --- /dev/null +++ b/docker/environments/php-7.4/build.sh @@ -0,0 +1,7 @@ +echo 'Starting PHP 7.4 build...' + +docker build --tag appwrite/env-php:7.4 . + +echo 'Pushing PHP 7.4 build to registry...' + +docker push appwrite/env-php:7.4 \ No newline at end of file diff --git a/docker/environments/python-3.8/Dockerfile b/docker/environments/python-3.8/Dockerfile new file mode 100644 index 000000000..fbb539a61 --- /dev/null +++ b/docker/environments/python-3.8/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.8-alpine + +LABEL maintainer="team@appwrite.io" + +RUN apk add tar + +ENV PIP_TARGET=./.appwrites \ No newline at end of file diff --git a/docker/environments/python-3.8/build.sh b/docker/environments/python-3.8/build.sh new file mode 100644 index 000000000..2dc97b783 --- /dev/null +++ b/docker/environments/python-3.8/build.sh @@ -0,0 +1,7 @@ +echo 'Starting Python 3.8 build...' + +docker build --tag appwrite/env-python:3.8 . + +echo 'Pushing Python 3.8 build to registry...' + +docker push appwrite/env-python:3.8 \ No newline at end of file diff --git a/docker/environments/ruby-2.7/Dockerfile b/docker/environments/ruby-2.7/Dockerfile new file mode 100644 index 000000000..81933a44e --- /dev/null +++ b/docker/environments/ruby-2.7/Dockerfile @@ -0,0 +1,5 @@ +FROM ruby:2.7-alpine + +LABEL maintainer="team@appwrite.io" + +RUN apk add tar \ No newline at end of file diff --git a/docker/environments/ruby-2.7/build.sh b/docker/environments/ruby-2.7/build.sh new file mode 100644 index 000000000..377d62a23 --- /dev/null +++ b/docker/environments/ruby-2.7/build.sh @@ -0,0 +1,7 @@ +echo 'Starting Ruby 2.7 build...' + +docker build --tag appwrite/env-ruby:2.7 . + +echo 'Pushing Ruby 2.7 build to registry...' + +docker push appwrite/env-ruby:2.7 \ No newline at end of file