From 8e920774909f723af0ffaea8ba0b4bcc9bd1b3bb Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Mon, 23 Feb 2026 14:58:42 +0000 Subject: [PATCH] Configured for docker container --- Dockerfile | 28 +++++++++++++++++++ backend/src/Controllers/SearchController.cs | 2 +- backend/src/Controllers/ServersController.cs | 2 +- backend/src/JellyGlass-test.db-shm | Bin 32768 -> 0 bytes backend/src/JellyGlass-test.db-wal | 0 backend/src/Program.cs | 21 +++++++++++++- frontend/src/Lib/api.ts | 2 +- 7 files changed, 51 insertions(+), 4 deletions(-) delete mode 100644 backend/src/JellyGlass-test.db-shm delete mode 100644 backend/src/JellyGlass-test.db-wal 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 fe9ac2845eca6fe6da8a63cd096d9cf9e24ece10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeIuAr62r3(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