diff --git a/csharp-httprequest.sln b/csharp-httprequest.sln deleted file mode 100644 index 0fc9be9..0000000 --- a/csharp-httprequest.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2035 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Function", "template\csharp-httprequest\function\Function.csproj", "{7A443F1C-78ED-416E-9625-0CAD4B63D7CA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "root", "template\csharp-httprequest\root.csproj", "{132C9C0D-0AF1-4D73-91B0-5C072B1B553E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7A443F1C-78ED-416E-9625-0CAD4B63D7CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7A443F1C-78ED-416E-9625-0CAD4B63D7CA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7A443F1C-78ED-416E-9625-0CAD4B63D7CA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7A443F1C-78ED-416E-9625-0CAD4B63D7CA}.Release|Any CPU.Build.0 = Release|Any CPU - {132C9C0D-0AF1-4D73-91B0-5C072B1B553E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {132C9C0D-0AF1-4D73-91B0-5C072B1B553E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {132C9C0D-0AF1-4D73-91B0-5C072B1B553E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {132C9C0D-0AF1-4D73-91B0-5C072B1B553E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D19A35C8-5F1E-4B8E-B82C-C6A548B5E62C} - EndGlobalSection -EndGlobal diff --git a/template/csharp-httprequest/Dockerfile b/template/csharp-httprequest/Dockerfile index 95953be..1feb314 100644 --- a/template/csharp-httprequest/Dockerfile +++ b/template/csharp-httprequest/Dockerfile @@ -1,21 +1,20 @@ -FROM alpine:3.8 as watchdog +FROM alpine:3.12 as watchdog RUN apk --no-cache add curl \ && echo "Pulling watchdog binary from Github." \ - && curl -sSL https://github.com/openfaas-incubator/of-watchdog/releases/download/0.5.1/of-watchdog > /usr/bin/fwatchdog \ + && curl -sSL https://github.com/openfaas-incubator/of-watchdog/releases/download/0.8.1/of-watchdog > /usr/bin/fwatchdog \ && chmod +x /usr/bin/fwatchdog \ && cp /usr/bin/fwatchdog /home/app \ && apk del curl --no-cache - -FROM mcr.microsoft.com/dotnet/core/sdk:2.2 as builder + +FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine as builder # Supress collection of data. ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 # Optimize for Docker builder caching by adding projects first. - -RUN mkdir -p /home/app/function -WORKDIR /home/app/function +RUN mkdir -p /home/app/src/function +WORKDIR /home/app/src/function COPY ./function/Function.csproj . WORKDIR /home/app/src/ @@ -26,7 +25,7 @@ COPY . . RUN dotnet publish -c release -o published -FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 +FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine COPY --from=watchdog /usr/bin/fwatchdog /usr/bin/ diff --git a/template/csharp-httprequest/Program.cs b/template/csharp-httprequest/Program.cs index 20c3165..e7c541c 100644 --- a/template/csharp-httprequest/Program.cs +++ b/template/csharp-httprequest/Program.cs @@ -1,12 +1,16 @@ -using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; public class Program { - public static void Main(string[] args) => CreateWebHostBuilder(args).Build().Run(); + public static void Main(string[] args) => CreateHostBuilder(args).Build().Run(); - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup() - .UseUrls("http://localhost:5000"); + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseKestrel(); + webBuilder.UseStartup(); + webBuilder.UseUrls("http://localhost:5000"); + }); } diff --git a/template/csharp-httprequest/Startup.cs b/template/csharp-httprequest/Startup.cs index 5b4b00f..dd76da7 100644 --- a/template/csharp-httprequest/Startup.cs +++ b/template/csharp-httprequest/Startup.cs @@ -11,7 +11,7 @@ public void ConfigureServices(IServiceCollection services) { } - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.Run(async (context) => { diff --git a/template/csharp-httprequest/function/Function.csproj b/template/csharp-httprequest/function/Function.csproj index ec15780..7c713fb 100644 --- a/template/csharp-httprequest/function/Function.csproj +++ b/template/csharp-httprequest/function/Function.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + net7.0 false diff --git a/template/csharp-httprequest/root.csproj b/template/csharp-httprequest/root.csproj index fde3a18..e8751ab 100644 --- a/template/csharp-httprequest/root.csproj +++ b/template/csharp-httprequest/root.csproj @@ -1,8 +1,7 @@ - - + Exe - netcoreapp2.2 + net7.0 false false false @@ -18,7 +17,7 @@ - + + -