diff --git a/Dockerfile b/Dockerfile index e69de29..5f2751e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS dotnet_build +WORKDIR /App + +COPY ./backend/src ./ + +RUN dotnet restore + +RUN dotnet publish -c Release -o out + +FROM node:25.6.1-bookworm AS react_build +WORKDIR /App + +COPY ./frontend ./ + +RUN npm ci +RUN npm run build + +FROM mcr.microsoft.com/dotnet/aspnet:9.0 +WORKDIR /App +EXPOSE 5000 +EXPOSE 5001 + +COPY --from=dotnet_build /App/out . +COPY --from=react_build /App/dist ./wwwroot + +ENV ASPNETCORE_URLS=http://+:5000 + +ENTRYPOINT ["dotnet", "JellyGlass-Backend.dll"] \ No newline at end of file diff --git a/backend/src/Controllers/SearchController.cs b/backend/src/Controllers/SearchController.cs index 3e4ede0..201ded1 100644 --- a/backend/src/Controllers/SearchController.cs +++ b/backend/src/Controllers/SearchController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc; namespace JellyGlass.Controllers; [ApiController] -[Route("[controller]")] +[Route("api/[controller]")] public class SearchController : ControllerBase { private ILogger _logger; diff --git a/backend/src/Controllers/ServersController.cs b/backend/src/Controllers/ServersController.cs index a38be5d..92e7ae3 100644 --- a/backend/src/Controllers/ServersController.cs +++ b/backend/src/Controllers/ServersController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc; namespace JellyGlass.Controllers; [ApiController] -[Route("[controller]")] +[Route("api/[controller]")] public class ServersController : ControllerBase { private ILogger _logger; diff --git a/backend/src/JellyGlass-test.db-shm b/backend/src/JellyGlass-test.db-shm deleted file mode 100644 index fe9ac28..0000000 Binary files a/backend/src/JellyGlass-test.db-shm and /dev/null differ diff --git a/backend/src/JellyGlass-test.db-wal b/backend/src/JellyGlass-test.db-wal deleted file mode 100644 index e69de29..0000000 diff --git a/backend/src/Program.cs b/backend/src/Program.cs index bc43a4e..1b19d18 100644 --- a/backend/src/Program.cs +++ b/backend/src/Program.cs @@ -1,5 +1,6 @@ using JellyGlass.Repositories; using JellyGlass.Services; +using Microsoft.EntityFrameworkCore; var builder = WebApplication.CreateBuilder(args); @@ -18,7 +19,7 @@ if (builder.Environment.IsDevelopment()) } else { - dbConnectionString = "Data Source./JellyGlass.db;"; + dbConnectionString = "Data Source=JellyGlass.db;"; } builder.Services.AddSqlite(dbConnectionString); @@ -31,6 +32,22 @@ builder.Services.AddTransient(); var app = builder.Build(); +using (var scope = app.Services.CreateScope()) +{ + var dbContext = scope.ServiceProvider.GetRequiredService(); + dbContext.Database.Migrate(); + + dbContext.Servers.Add(new JellyGlass.Models.Server() + { + ApiToken = "56b6f91b816540b59d03a0db53c2dc8e", + Id = "1", + Owner = "Riley", + Url = "https://jellyfin.foxhawk.co.uk" + }); + + dbContext.SaveChanges(); +} + // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { @@ -39,5 +56,7 @@ if (app.Environment.IsDevelopment()) app.UseHttpsRedirection(); app.MapControllers(); +app.UseDefaultFiles(); +app.UseStaticFiles(); app.Run(); diff --git a/frontend/src/Lib/api.ts b/frontend/src/Lib/api.ts index bc0d3d2..4fd6c38 100644 --- a/frontend/src/Lib/api.ts +++ b/frontend/src/Lib/api.ts @@ -1,2 +1,2 @@ -export const apiUrl = "http://localhost:5092" \ No newline at end of file +export const apiUrl = "http://localhost:5000/api" \ No newline at end of file