Skip to content
Merged
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
10 changes: 5 additions & 5 deletions template/csharp-httprequest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.8 as watchdog
FROM alpine:3.12 as watchdog

RUN apk --no-cache add curl \
&& echo "Pulling watchdog binary from Github." \
Expand All @@ -7,15 +7,15 @@ RUN apk --no-cache add curl \
&& 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:5.0 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 +26,7 @@ COPY . .

RUN dotnet publish -c release -o published

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
FROM mcr.microsoft.com/dotnet/aspnet:5.0.0

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
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>net5.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>