From 084978d6811cce303c1fc41318c8a88e32180370 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 11 May 2023 12:33:17 +0300 Subject: [PATCH] upgrade .NET to v6 --- Dockerfile | 29 +++++++++++++++++------------ ELT.Client/ELT.Client.csproj | 2 +- ELT.Tests/ELT.Tests.csproj | 2 +- ELT/ELT.csproj | 21 ++++++++++----------- ELT/Properties/launchSettings.json | 4 ++-- ELT/Startup.cs | 6 ------ 6 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e3ecd6..9e29849 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/ELT.Client/ELT.Client.csproj b/ELT.Client/ELT.Client.csproj index 8abeaa6..06e31f3 100644 --- a/ELT.Client/ELT.Client.csproj +++ b/ELT.Client/ELT.Client.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net6.0 diff --git a/ELT.Tests/ELT.Tests.csproj b/ELT.Tests/ELT.Tests.csproj index 1425966..9108016 100644 --- a/ELT.Tests/ELT.Tests.csproj +++ b/ELT.Tests/ELT.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net6.0 false diff --git a/ELT/ELT.csproj b/ELT/ELT.csproj index 11c598d..bc909bd 100644 --- a/ELT/ELT.csproj +++ b/ELT/ELT.csproj @@ -1,18 +1,17 @@ - - netcoreapp3.1 - Linux - + + default + net6.0 + - - - - + + + - - - + + + diff --git a/ELT/Properties/launchSettings.json b/ELT/Properties/launchSettings.json index b6fad87..a760566 100644 --- a/ELT/Properties/launchSettings.json +++ b/ELT/Properties/launchSettings.json @@ -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", diff --git a/ELT/Startup.cs b/ELT/Startup.cs index 9ae5d68..adaa384 100644 --- a/ELT/Startup.cs +++ b/ELT/Startup.cs @@ -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(); });