Skip to content

Commit 304eb87

Browse files
committedFeb 18, 2020
Update to dotnet 3.1
1 parent 82f5423 commit 304eb87

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed
 

‎Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
1+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
22
WORKDIR /app
33

44
# Copy csproj and restore as distinct layers
@@ -21,7 +21,7 @@ RUN dotnet test Hexastore.Test
2121
RUN dotnet publish -c Release ./Hexastore.Web -o /app/out
2222

2323
# Build runtime image
24-
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
24+
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
2525
WORKDIR /app
2626
COPY --from=build-env /app/out .
2727

@@ -30,6 +30,6 @@ RUN apt-get update && apt-get install -y libcap2-bin libsnappy1v5 && \
3030
ln -s /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so && \
3131
rm -rf /var/lib/apt/lists/*
3232

33-
ENV ENV LD_LIBRARY_PATH=ENV LD_LIBRARY_PATH:/app/bin/Debug/netcoreapp2.2/native/amd64/:/app/bin/Release/netcoreapp2.2/native/amd64/
33+
ENV ENV LD_LIBRARY_PATH=ENV LD_LIBRARY_PATH:/app/bin/Debug/netcoreapp3.1/native/amd64/:/app/bin/Release/netcoreapp3.1/native/amd64/
3434
EXPOSE 80
3535
ENTRYPOINT ["dotnet", "Hexastore.Web.dll"]

‎Hexastore.PerfConsole/Hexastore.PerfConsole.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<NoWarn>NU1608</NoWarn>
77
</PropertyGroup>
88

‎Hexastore.Test/Hexastore.Test.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

‎Hexastore.Web/Hexastore.Web.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
</PropertyGroup>
@@ -15,12 +15,8 @@
1515

1616
<ItemGroup>
1717
<PackageReference Include="dotenv.net" Version="1.0.4" />
18-
<PackageReference Include="Microsoft.AspNetCore.App" />
19-
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
20-
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
18+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
2119
<PackageReference Include="Microsoft.Azure.EventHubs" Version="3.0.0" />
22-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" />
23-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
2420
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
2521
</ItemGroup>
2622

‎Hexastore.Web/Startup.cs

+15-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
using Microsoft.AspNetCore.Hosting;
1212
using Microsoft.Extensions.Configuration;
1313
using Microsoft.Extensions.DependencyInjection;
14+
using Microsoft.Extensions.Hosting;
15+
using Microsoft.AspNetCore.Mvc.NewtonsoftJson;
1416

1517
namespace Hexastore.Web
1618
{
@@ -26,20 +28,19 @@ public Startup(IConfiguration configuration)
2628
// This method gets called by the runtime. Use this method to add services to the container.
2729
public void ConfigureServices(IServiceCollection services)
2830
{
29-
// services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
30-
services.AddCors(options =>
31-
{
31+
services.AddCors(options => {
3232
options.AddPolicy("AllowAnyOrigin",
3333
builder => builder
3434
.AllowAnyOrigin()
3535
.AllowAnyMethod()
3636
.WithExposedHeaders("content-disposition")
3737
.AllowAnyHeader()
38-
.AllowCredentials()
3938
.SetPreflightMaxAge(TimeSpan.FromSeconds(3600)));
4039
});
4140

42-
services.AddMvc();
41+
42+
services.AddControllers().AddNewtonsoftJson();
43+
4344
services.AddSingleton<IGraphProvider, RocksGraphProvider>();
4445
services.AddSingleton<IReasoner, Reasoner>();
4546
services.AddSingleton<IStoreProcesor, StoreProcessor>();
@@ -54,7 +55,7 @@ public void ConfigureServices(IServiceCollection services)
5455
}
5556

5657
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
57-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
58+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5859
{
5960
if (File.Exists("/var/data/Hexastore.env")) {
6061
DotEnv.Config(false, "/var/data/Hexastore.env");
@@ -68,7 +69,14 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
6869
app.UseCors("AllowAnyOrigin");
6970

7071
app.UseMiddleware<PerfHeaderMiddleware>();
71-
app.UseMvc();
72+
73+
// app.UseHttpsRedirection();
74+
// app.UseAuthorization();
75+
app.UseRouting();
76+
77+
app.UseEndpoints(endpoints => {
78+
endpoints.MapControllers();
79+
});
7280
}
7381
}
7482
}

‎Hexastore/Hexastore.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<ItemGroup>
88
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
9-
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
9+
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.0" />
1010
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
1111
</ItemGroup>
1212

0 commit comments

Comments
 (0)