1
0
Fork 0
mirror of synced 2024-04-26 17:12:23 +12:00

feat(functions): dotnet env added

This commit is contained in:
Torsten Dittmann 2021-01-26 11:29:53 +01:00
parent 139b9efcff
commit 95ab7f8bad
14 changed files with 152 additions and 0 deletions

View file

@ -106,6 +106,24 @@ $environments = [
'logo' => 'dart.png',
'supports' => [System::X86],
],
'dotnet-3.1' => [
'name' => '.NET',
'version' => '3.1',
'base' => 'mcr.microsoft.com/dotnet/runtime:3.1-alpine',
'image' => 'appwrite/env-dotnet-3.1:1.0.0',
'build' => '/usr/src/code/docker/environments/dotnet-3.1',
'logo' => 'dotnet.png',
'supports' => [System::X86, System::ARM],
],
'dotnet-5.0' => [
'name' => '.NET',
'version' => '5.0',
'base' => 'mcr.microsoft.com/dotnet/runtime:5.0-alpine',
'image' => 'appwrite/env-dotnet-5.0:1.0.0',
'build' => '/usr/src/code/docker/environments/dotnet-5.0',
'logo' => 'dotnet.png',
'supports' => [System::X86, System::ARM],
],
];
$allowList = empty(App::getEnv('_APP_FUNCTIONS_ENVS', null)) ? false : \explode(',', App::getEnv('_APP_FUNCTIONS_ENVS', null));

View file

@ -32,3 +32,9 @@ docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -
echo 'Dart 2.10...'
docker buildx build --platform linux/amd64 -t appwrite/env-dart-2.10:1.0.0 ./docker/environments/dart-2.10/ --push
echo '.NET 3.1...'
docker buildx build --platform linux/amd64,linux/arm64 -t appwrite/env-dotnet-3.1:1.0.0 ./docker/environments/dotnet-3.1/ --push
echo '.NET 5.0...'
docker buildx build --platform linux/amd64,linux/arm64 -t appwrite/env-dotnet-5.0:1.0.0 ./docker/environments/dotnet-5.0/ --push

View file

@ -0,0 +1,7 @@
FROM mcr.microsoft.com/dotnet/runtime:3.1-alpine
LABEL maintainer="team@appwrite.io"
RUN apk add tar
WORKDIR /usr/local/src/

View file

@ -0,0 +1,7 @@
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine
LABEL maintainer="team@appwrite.io"
RUN apk add tar
WORKDIR /usr/local/src/

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -543,6 +543,22 @@ class FunctionsCustomServerTest extends Scope
'command' => 'dart run main.dart',
'timeout' => 15,
],
[
'language' => '.NET',
'version' => '3.1',
'name' => 'dotnet-3.1',
'code' => $functions.'/dotnet-3.1.tar.gz',
'command' => 'dotnet dotnet.dll',
'timeout' => 15,
],
[
'language' => '.NET',
'version' => '5.0',
'name' => 'dotnet-5.0',
'code' => $functions.'/dotnet-5.0.tar.gz',
'command' => 'dotnet dotnet.dll',
'timeout' => 15,
],
];
sleep(count($envs) * 25);

Binary file not shown.

View file

@ -0,0 +1,28 @@
using System;
using Appwrite;
namespace dotnet
{
class Program
{
static void Main(string[] args)
{
Client client = new Client();
client.SetEndPoint(Environment.GetEnvironmentVariable("APPWRITE_ENDPOINT"));
client.SetProject(Environment.GetEnvironmentVariable("APPWRITE_PROJECT"));
client.SetKey(Environment.GetEnvironmentVariable("APPWRITE_SECRET"));
Storage storage = new Storage(client);
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ID"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_NAME"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TAG"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TRIGGER"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_NAME"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_VERSION"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT_PAYLOAD"));
}
}
}

View file

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Appwrite" Version="0.0.3" />
</ItemGroup>
</Project>

Binary file not shown.

View file

@ -0,0 +1,28 @@
using System;
using Appwrite;
namespace dotnet
{
class Program
{
static void Main(string[] args)
{
Client client = new Client();
client.SetEndPoint(Environment.GetEnvironmentVariable("APPWRITE_ENDPOINT"));
client.SetProject(Environment.GetEnvironmentVariable("APPWRITE_PROJECT"));
client.SetKey(Environment.GetEnvironmentVariable("APPWRITE_SECRET"));
Storage storage = new Storage(client);
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ID"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_NAME"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TAG"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TRIGGER"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_NAME"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_VERSION"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT"));
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT_PAYLOAD"));
}
}
}

View file

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Appwrite" Version="0.0.3" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,12 @@
echo '.NET 3.1 Packaging...'
cp -r $(pwd)/tests/resources/functions/dotnet-3.1 $(pwd)/tests/resources/functions/packages/dotnet-3.1
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-3.1:/app -w /app mcr.microsoft.com/dotnet/sdk:3.1-alpine dotnet restore
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-3.1:/app -w /app mcr.microsoft.com/dotnet/sdk:3.1-alpine dotnet publish -o ./release
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-3.1:/app -w /app/release appwrite/env-dotnet-3.1:1.0.0 tar -zcvf ../code.tar.gz .
mv $(pwd)/tests/resources/functions/packages/dotnet-3.1/code.tar.gz $(pwd)/tests/resources/functions/dotnet-3.1.tar.gz
rm -r $(pwd)/tests/resources/functions/packages/dotnet-3.1

View file

@ -0,0 +1,12 @@
echo '.NET 5.0 Packaging...'
cp -r $(pwd)/tests/resources/functions/dotnet-5.0 $(pwd)/tests/resources/functions/packages/dotnet-5.0
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-5.0:/app -w /app mcr.microsoft.com/dotnet/sdk:5.0-alpine dotnet restore
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-5.0:/app -w /app mcr.microsoft.com/dotnet/sdk:5.0-alpine dotnet publish -o ./release
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-5.0:/app -w /app/release appwrite/env-dotnet-5.0:1.0.0 tar -zcvf ../code.tar.gz .
mv $(pwd)/tests/resources/functions/packages/dotnet-5.0/code.tar.gz $(pwd)/tests/resources/functions/dotnet-5.0.tar.gz
rm -r $(pwd)/tests/resources/functions/packages/dotnet-5.0