upgrade .NET to v6

This commit is contained in:
vchikalkin 2023-05-11 12:33:17 +03:00
parent e6d812fe6b
commit 084978d681
6 changed files with 31 additions and 33 deletions

View File

@ -1,19 +1,24 @@
# Stage 1
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /build
COPY . .
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS base
WORKDIR /app
EXPOSE 5000
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
WORKDIR /src
COPY ["ELT/ELT.csproj", "ELT/"]
COPY ./NuGet.Config /nuget.config
COPY ./evoleasing_25.crt /etc/ssl/certs
RUN update-ca-certificates
RUN dotnet restore
RUN dotnet publish -c Release -o /app
# Stage 2
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS final
RUN dotnet restore "ELT/ELT.csproj"
COPY . .
WORKDIR "/src/ELT"
RUN dotnet build "ELT.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "ELT.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=build /app .
EXPOSE 5000
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ELT.dll"]

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<LangVersion>default</LangVersion>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.0.7" />
</ItemGroup>
<ItemGroup>

View File

@ -22,9 +22,9 @@
"commandName": "Project",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:2121"
"applicationUrl": "http://localhost:5000"
},
"Docker": {
"commandName": "Docker",

View File

@ -19,8 +19,6 @@ namespace ELT
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddSwaggerGen();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -28,10 +26,6 @@ namespace ELT
{
if (env.IsDevelopment()) app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI();
app.UseRouting();
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });