diff --git a/app/config/environments.php b/app/config/environments.php index 3dd4728c45..473da1b769 100644 --- a/app/config/environments.php +++ b/app/config/environments.php @@ -70,6 +70,15 @@ $environments = [ 'logo' => 'python.png', 'supports' => [System::X86, System::PPC, System::ARM], ], + 'python-3.9' => [ + 'name' => 'Python', + 'version' => '3.9', + 'base' => 'python:3.9-alpine', + 'image' => 'appwrite/env-python-3.9:1.0.0', + 'build' => '/usr/src/code/docker/environments/python-3.9', + 'logo' => 'python.png', + 'supports' => [System::X86, System::PPC, System::ARM], + ], 'deno-1.2' => [ 'name' => 'Deno', 'version' => '1.2', diff --git a/app/config/variables.php b/app/config/variables.php index 20b49bd9e8..b6e93eabb9 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -381,7 +381,7 @@ return [ 'name' => '_APP_FUNCTIONS_ENVS', 'description' => 'This option allows you to limit the available environments for cloud functions. This option is very useful for low-cost servers to safe disk space.\n\nTo enable/activate this option, pass a list of allowed environments separated by a comma.\n\nCurrently, supported environments are: ' . \implode(', ', \array_keys(Config::getParam('providers'))), 'introduction' => '0.7.0', - 'default' => 'node-14.5,deno-1.6,php-7.4,python-3.8,ruby-3.0,dotnet-5.0', + 'default' => 'node-14.5,deno-1.6,php-7.4,python-3.9,ruby-3.0,dotnet-5.0', 'required' => false, 'question' => '', ], diff --git a/docker/environments/build.sh b/docker/environments/build.sh index 1385dc9e35..6dffb17611 100644 --- a/docker/environments/build.sh +++ b/docker/environments/build.sh @@ -24,6 +24,9 @@ docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 echo 'Python 3.8...' docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-python-3.8:1.0.0 ./docker/environments/python-3.8/ --push +echo 'Python 3.9...' +docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-python-3.9:1.0.0 ./docker/environments/python-3.9/ --push + echo 'Ruby 2.7...' docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-ruby-2.7:1.0.2 ./docker/environments/ruby-2.7/ --push diff --git a/docker/environments/python-3.9/Dockerfile b/docker/environments/python-3.9/Dockerfile new file mode 100644 index 0000000000..94b7b8ceb8 --- /dev/null +++ b/docker/environments/python-3.9/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.9-alpine + +LABEL maintainer="team@appwrite.io" + +RUN apk add tar + +RUN mkdir /usr/local/src + +WORKDIR /usr/local/src/ + +ENV PYTHONPATH "${PYTHONPATH}:/usr/local/src/.appwrite" \ No newline at end of file diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index e7dd7712c7..504106dace 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -485,6 +485,14 @@ class FunctionsCustomServerTest extends Scope 'command' => 'python main.py', 'timeout' => 15, ], + [ + 'language' => 'Python', + 'version' => '3.9', + 'name' => 'python-3.9', + 'code' => $functions.'/python.tar.gz', + 'command' => 'python main.py', + 'timeout' => 15, + ], [ 'language' => 'Node.js', 'version' => '14.5',