diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8efd1d1..c4d8b15 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ variables: Build: stage: build - image: mcr.microsoft.com/dotnet/core/sdk:5.0-focal + image: mcr.microsoft.com/dotnet/sdk:5.0 artifacts: expire_in: 1h paths: diff --git a/Dockerfile b/Dockerfile index 479dd40..245e06b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-focal +FROM mcr.microsoft.com/dotnet/aspnet:5.0 COPY ./app /app/ diff --git a/src/Bot/Bot.csproj b/src/Bot/Bot.csproj index 49f0b16..60f6473 100644 --- a/src/Bot/Bot.csproj +++ b/src/Bot/Bot.csproj @@ -22,7 +22,6 @@ - diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj index 5ad67b3..7b273fd 100644 --- a/src/Core/Core.csproj +++ b/src/Core/Core.csproj @@ -13,19 +13,19 @@ - - - - - - - - + + + + + + + + - + diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj index 429165b..5080a3d 100644 --- a/src/Web/Web.csproj +++ b/src/Web/Web.csproj @@ -1,4 +1,4 @@ - + net5.0 @@ -10,15 +10,6 @@ NU1701 - - - - - - - - - diff --git a/src/Web/WebApiStartup.cs b/src/Web/WebApiStartup.cs index 9aeedf9..0c18886 100644 --- a/src/Web/WebApiStartup.cs +++ b/src/Web/WebApiStartup.cs @@ -18,6 +18,9 @@ namespace Geekbot.Web { public static class WebApiStartup { + // Using the "Microsoft.NET.Sdk.Web" SDK requires a static main function... + public static void Main() {} + public static void StartWebApi(IGeekbotLogger logger, RunParameters runParameters, CommandService commandService, DatabaseContext databaseContext, DiscordSocketClient client, IGlobalSettings globalSettings, IHighscoreManager highscoreManager) { @@ -28,22 +31,27 @@ namespace Geekbot.Web }) .ConfigureServices(services => { - services.AddMvc(); - services.AddSingleton(commandService); - services.AddSingleton(databaseContext); - services.AddSingleton(client); - services.AddSingleton(globalSettings); - services.AddSingleton(highscoreManager); + services.AddControllers(); services.AddCors(options => { options.AddPolicy("AllowSpecificOrigin", builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); }); + + services.AddSingleton(commandService); + services.AddSingleton(databaseContext); + services.AddSingleton(client); + services.AddSingleton(globalSettings); + services.AddSingleton(highscoreManager); }) .Configure(app => { - app.UseMvc(); + app.UseRouting(); app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().Build()); + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); }) .ConfigureLogging(logging => {