dotnet Core example

This commit is contained in:
Alex Ellis 2017-04-12 10:41:32 +01:00
parent c3bbec09c1
commit b69bca09a3
5 changed files with 55 additions and 0 deletions

View File

@ -11,4 +11,5 @@ Each one will read the request from the watchdog then print it back resulting in
| Golang | functions/base:golang-1.7.5-alpine | Golang compiled on Alpine Linux |
| Python | functions/base:python-2.7-alpine | Python 2.7 built on Alpine Linux |
| Java | functions/base:openjdk-8u121-jdk-alpine | OpenJDK built on Alpine Linux |
| Dotnet Core | functions/base:dotnet-sdk | Microsoft dotnet core SDK |
| Busybox / shell | functions/alpine:latest | Busybox contains useful binaries which can be turned into a FaaS function such as `sha512sum` or `cat` |

View File

@ -0,0 +1,16 @@
FROM microsoft/dotnet:sdk
ADD https://github.com/alexellis/faas/releases/download/v0.5-alpha/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
WORKDIR /root/
COPY src src
WORKDIR /root/src
RUN dotnet restore
RUN dotnet build
ENV fprocess="dotnet ./bin/Debug/netcoreapp1.1/root.dll"
EXPOSE 8080
CMD ["fwatchdog"]

View File

@ -0,0 +1,5 @@
bin/
obj/
.nuget/
.dotnet/
.templateengine/

View File

@ -0,0 +1,25 @@
using System;
using System.Text;
namespace root
{
class Program
{
private static string getStdin() {
StringBuilder buffer = new StringBuilder();
string s;
while ((s = Console.ReadLine()) != null)
{
buffer.AppendLine(s);
}
return buffer.ToString();
}
static void Main(string[] args)
{
string buffer = getStdin();
Console.WriteLine(buffer);
}
}
}

View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
</Project>