Appwrite repository for Cloud Function runtimes that contains the configurations and tests for all of the Appwrite runtime environments. This library is maintained by the Appwrite team.
Install using composer:
composer require appwrite/php-runtimes
<?php require_once '../vendor/autoload.php'; use Appwrite\Runtimes\Runtimes; $runtimes = new Runtime(); // returns all supported cloud function runtimes Runtimes::getAll();
Adding a new Runtime
The first thing to do is to create a Dockerfile under
Important features for a base image are small sizes (Alpine preferred), multi-architecture (x86, ARM, PPC) and active maintenance.
Example for a Dockerfile looks like this:
# Base image FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine # Maintainer label LABEL maintainer="[email protected]" # Add tar (required for uncompressing functions) RUN apk add tar # Set working directory to /usr/local/src/ WORKDIR /usr/local/src/
After that the build command must be added to the
2. Add Runtime
After the Docker image is created, this must be added to the main class of this library.
References to this must be added to the constructor of
$dotnet = new Runtime('dotnet', '.NET'); $dotnet->addVersion('5.0', 'mcr.microsoft.com/dotnet/runtime:5.0-alpine', 'appwrite/env-dotnet-5.0:1.0.0', [System::X86, System::ARM]); $runtimes = $dotnet;
3. Add Tests
First of all, a script for the runtime environment must be created. Plenty of examples can be found under
After that start options must be added to the
setUp() method found in
Copyright and license
BSD 3-Clause License https://opensource.org/licenses/BSD-3-Clause