Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions csharp-httprequest.sln

This file was deleted.

15 changes: 7 additions & 8 deletions template/csharp-httprequest/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
Expand All @@ -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/

Expand Down
16 changes: 10 additions & 6 deletions template/csharp-httprequest/Program.cs
Original file line number Diff line number Diff line change
@@ -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<Startup>()
.UseUrls("http://localhost:5000");
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseKestrel();
webBuilder.UseStartup<Startup>();
webBuilder.UseUrls("http://localhost:5000");
});
}
2 changes: 1 addition & 1 deletion template/csharp-httprequest/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
{
Expand Down
2 changes: 1 addition & 1 deletion template/csharp-httprequest/function/Function.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

Expand Down
9 changes: 4 additions & 5 deletions template/csharp-httprequest/root.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ServerGarbageCollection>false</ServerGarbageCollection>
<EnableDefaultItems>false</EnableDefaultItems>
Expand All @@ -18,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
</ItemGroup>

</Project>