mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-06-14 16:56:22 -04:00
fixed initial docker build
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
# Build Angular frontend
|
||||
FROM --platform=$BUILDPLATFORM node:18-alpine AS frontend-build
|
||||
ARG BASE_PATH=""
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files first for better layer caching
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm ci --only=production
|
||||
RUN npm ci && npm install -g @angular/cli
|
||||
|
||||
# Copy source code
|
||||
COPY frontend/ .
|
||||
RUN npm run build -- --base-href="${BASE_PATH}/" --deploy-url="${BASE_PATH}/"
|
||||
|
||||
# Build with appropriate base-href and deploy-url
|
||||
RUN npm run build
|
||||
|
||||
# Build .NET backend
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-bookworm-slim AS build
|
||||
@@ -15,8 +20,18 @@ ARG PACKAGES_USERNAME
|
||||
ARG PACKAGES_PAT
|
||||
WORKDIR /app
|
||||
EXPOSE 11011
|
||||
COPY . ./
|
||||
|
||||
# Copy solution and project files first for better layer caching
|
||||
# COPY backend/*.sln ./backend/
|
||||
# COPY backend/*/*.csproj ./backend/*/
|
||||
|
||||
# Copy source code
|
||||
COPY backend/ ./backend/
|
||||
|
||||
# Restore dependencies
|
||||
RUN dotnet nuget add source --username ${PACKAGES_USERNAME} --password ${PACKAGES_PAT} --store-password-in-clear-text --name Cleanuparr https://nuget.pkg.github.com/flmorg/index.json
|
||||
|
||||
# Build and publish
|
||||
RUN dotnet publish ./backend/Cleanuparr.Api/Cleanuparr.Api.csproj \
|
||||
-a $TARGETARCH \
|
||||
-c Release \
|
||||
@@ -36,6 +51,6 @@ WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
# Copy frontend to wwwroot
|
||||
COPY --from=frontend-build /app/dist ./wwwroot
|
||||
COPY --from=frontend-build /app/dist/ui/browser ./wwwroot
|
||||
|
||||
ENTRYPOINT ["./cleanuparr"]
|
||||
@@ -3,12 +3,12 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace Cleanuparr.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("")]
|
||||
[Route("api")]
|
||||
public class ApiDocumentationController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public IActionResult RedirectToSwagger()
|
||||
{
|
||||
return Redirect("/swagger");
|
||||
return Redirect("/api/swagger");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,23 @@ using Serilog;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
int? port = builder.Configuration.GetValue<int>("PORT");
|
||||
|
||||
if (port is null or 0)
|
||||
{
|
||||
port = 11011;
|
||||
}
|
||||
|
||||
builder.WebHost.UseUrls($"http://*:{port}");
|
||||
|
||||
builder.Configuration
|
||||
.AddJsonFile(Path.Combine(ConfigurationPathProvider.GetConfigPath(), "cleanuparr.json"), optional: true, reloadOnChange: true);
|
||||
|
||||
builder.Services.AddResponseCompression(options =>
|
||||
{
|
||||
options.EnableForHttps = true;
|
||||
});
|
||||
|
||||
// Configure JSON options to serialize enums as strings
|
||||
builder.Services.ConfigureHttpJsonOptions(options =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user