Update to .NET 5

This commit is contained in:
Miguel Veloso 2021-06-17 17:17:04 +01:00
parent 07e0bfe0f2
commit 2a0db634c4
4 changed files with 48 additions and 55 deletions

@ -1,10 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base ARG NODE_IMAGE=node:12.0
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
FROM node as node-build FROM ${NODE_IMAGE} as node-build
WORKDIR /web/src WORKDIR /web/src
COPY Web/WebSPA/Client/package.json . COPY Web/WebSPA/Client/package.json .
COPY Web/WebSPA/Client/package-lock.json . COPY Web/WebSPA/Client/package-lock.json .
@ -12,7 +13,7 @@ RUN npm install
COPY Web/WebSPA/Client . COPY Web/WebSPA/Client .
RUN npm run build:prod RUN npm run build:prod
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src WORKDIR /src
# Create this "restore-solution" section by running ./Create-DockerfileSolutionRestore.ps1, to optimize build cache reuse # Create this "restore-solution" section by running ./Create-DockerfileSolutionRestore.ps1, to optimize build cache reuse

@ -1,20 +1,14 @@
using Microsoft.AspNetCore; using eShopConContainers.WebSPA;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog; using Serilog;
using System.IO;
namespace eShopConContainers.WebSPA
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run(); BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) => IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
@ -39,5 +33,3 @@ namespace eShopConContainers.WebSPA
.WriteTo.Console(); .WriteTo.Console();
}) })
.Build(); .Build();
}
}

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<UserSecretsId>aspnetcorespa-c23d27a4-eb88-4b18-9b77-2a93f3b15119</UserSecretsId> <UserSecretsId>aspnetcorespa-c23d27a4-eb88-4b18-9b77-2a93f3b15119</UserSecretsId>
<TypeScriptCompileOnSaveEnabled>false</TypeScriptCompileOnSaveEnabled> <TypeScriptCompileOnSaveEnabled>false</TypeScriptCompileOnSaveEnabled>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled> <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
@ -32,20 +32,20 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.2" /> <PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.0.0" /> <PackageReference Include="AspNetCore.HealthChecks.Uris" Version="5.0.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.17.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.17.0" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="3.1.1" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.2" /> <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="5.0.7" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.7" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" /> <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" /> <PackageReference Include="Serilog.Sinks.Seq" Version="5.0.1" />
</ItemGroup> </ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') "> <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">

@ -135,7 +135,7 @@ services:
context: . context: .
dockerfile: Web/WebSPA/Dockerfile dockerfile: Web/WebSPA/Dockerfile
args: args:
NODE_IMAGE: ${NODE_IMAGE:-node:10.13} NODE_IMAGE: ${NODE_IMAGE:-node:12.0}
depends_on: depends_on:
- webshoppingagg - webshoppingagg
- webshoppingapigw - webshoppingapigw