Skip to content

Appwrite configuration for Cloud Function runtimes settings 🌩

License

Notifications You must be signed in to change notification settings

Maatteogekko/php-runtimes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Appwrite Runtimes

Build Status Total Downloads Discord

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.

Getting Started

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

1. Docker

The first thing to do is to create a Dockerfile under runtimes/.

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="team@appwrite.io"
# 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 build.sh script.

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 src/Runtimes/Runtimes.php.

Example:

$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 tests/resources.

After that start options must be added to the setUp() method found in tests/Runtimes/RuntimesTest.php.

Authors

Torsten Dittmann

Copyright and license

BSD 3-Clause License https://opensource.org/licenses/BSD-3-Clause

About

Appwrite configuration for Cloud Function runtimes settings 🌩

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 48.0%
  • Shell 22.2%
  • Dockerfile 8.7%
  • C# 6.6%
  • Dart 2.6%
  • TypeScript 2.5%
  • Other 9.4%