feat(functions): dotnet env added
This commit is contained in:
parent
139b9efcff
commit
95ab7f8bad
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
7
docker/environments/dotnet-3.1/Dockerfile
Normal file
7
docker/environments/dotnet-3.1/Dockerfile
Normal 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/
|
7
docker/environments/dotnet-5.0/Dockerfile
Normal file
7
docker/environments/dotnet-5.0/Dockerfile
Normal 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/
|
BIN
public/images/environments/dotnet.png
Normal file
BIN
public/images/environments/dotnet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
|
@ -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);
|
||||
|
|
BIN
tests/resources/functions/dotnet-3.1.tar.gz
Normal file
BIN
tests/resources/functions/dotnet-3.1.tar.gz
Normal file
Binary file not shown.
28
tests/resources/functions/dotnet-3.1/Program.cs
Normal file
28
tests/resources/functions/dotnet-3.1/Program.cs
Normal 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"));
|
||||
}
|
||||
}
|
||||
}
|
9
tests/resources/functions/dotnet-3.1/dotnet.csproj
Normal file
9
tests/resources/functions/dotnet-3.1/dotnet.csproj
Normal 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>
|
BIN
tests/resources/functions/dotnet-5.0.tar.gz
Normal file
BIN
tests/resources/functions/dotnet-5.0.tar.gz
Normal file
Binary file not shown.
28
tests/resources/functions/dotnet-5.0/Program.cs
Normal file
28
tests/resources/functions/dotnet-5.0/Program.cs
Normal 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"));
|
||||
}
|
||||
}
|
||||
}
|
9
tests/resources/functions/dotnet-5.0/dotnet.csproj
Normal file
9
tests/resources/functions/dotnet-5.0/dotnet.csproj
Normal 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>
|
12
tests/resources/functions/package-dotnet-3.1.sh
Normal file
12
tests/resources/functions/package-dotnet-3.1.sh
Normal 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
|
12
tests/resources/functions/package-dotnet-5.0.sh
Normal file
12
tests/resources/functions/package-dotnet-5.0.sh
Normal 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
|
Loading…
Reference in a new issue