diff --git a/proxy/deploy.go b/proxy/deploy.go index 2fa5ac37d..240c98605 100644 --- a/proxy/deploy.go +++ b/proxy/deploy.go @@ -28,7 +28,7 @@ func DeployFunction(fprocess string, gateway string, functionName string, image } else if language == "ruby" { fprocessTemplate = "ruby index.rb" } else if language == "csharp" { - fprocessTemplate = "dotnet ./bin/Debug/netcoreapp2.0/root.dll" + fprocessTemplate = "dotnet ./root.dll" } gateway = strings.TrimRight(gateway, "/") diff --git a/template/csharp/Dockerfile b/template/csharp/Dockerfile index cc6cb70f8..cf76c6f3e 100644 --- a/template/csharp/Dockerfile +++ b/template/csharp/Dockerfile @@ -1,4 +1,14 @@ -FROM microsoft/dotnet:2.0-sdk +FROM microsoft/dotnet:2.0-sdk as builder + +ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 + +WORKDIR /root/ +WORKDIR /root/src +COPY . . +RUN dotnet restore ./root.csproj +RUN dotnet publish -c release -o published + +FROM microsoft/dotnet:2.0-runtime #ADD https://github.com/alexellis/faas/releases/download/0.6.1/fwatchdog /usr/bin RUN apt-get update -qy \ @@ -10,14 +20,10 @@ RUN apt-get update -qy \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 - WORKDIR /root/ -WORKDIR /root/src -COPY . . -RUN dotnet restore ./root.csproj -RUN dotnet build +COPY --from=builder /root/src/published . -ENV fprocess="dotnet ./bin/Debug/netcoreapp2.0/root.dll" +ENV fprocess="dotnet ./root.dll" EXPOSE 8080 CMD ["fwatchdog"] +