From 62dc7bd93fd07d39d11db7388dc6e53b6821fe78 Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Mon, 20 Oct 2025 19:28:01 +0100 Subject: [PATCH] fix: Change Dockerfile to run ASP.NET Core instead of static nginx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Blazor Web App requires the ASP.NET runtime to function properly, as it uses interactive server components. Changed from nginx serving static files to running the full .NET application. Changes: - Updated Dockerfile to use aspnet:9.0 runtime image - Removed nginx configuration (no longer needed) - Disabled HTTPS redirection (running behind reverse proxy) - Added publish/ folder to .gitignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .gitignore | 3 +++ BlazorApp/Program.cs | 3 +-- Dockerfile | 17 +++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index ba39fdc..2df1779 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,9 @@ bld/ # Backup folder old-static-site/ +# Publish output +publish/ + # OS Files .DS_Store Thumbs.db diff --git a/BlazorApp/Program.cs b/BlazorApp/Program.cs index 25fc569..138807b 100644 --- a/BlazorApp/Program.cs +++ b/BlazorApp/Program.cs @@ -16,8 +16,7 @@ if (!app.Environment.IsDevelopment()) app.UseHsts(); } -app.UseHttpsRedirection(); - +// app.UseHttpsRedirection(); // Disabled - running behind reverse proxy app.UseAntiforgery(); diff --git a/Dockerfile b/Dockerfile index 2540884..cb14491 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,16 +14,17 @@ WORKDIR /src/BlazorApp RUN dotnet publish "SilverLabs.Website.csproj" -c Release -o /app/publish # Runtime stage -FROM nginx:alpine +FROM mcr.microsoft.com/dotnet/aspnet:9.0 -# Copy the published Blazor app to nginx html directory -COPY --from=build /app/publish/wwwroot /usr/share/nginx/html - -# Copy custom nginx configuration -COPY nginx-blazor.conf /etc/nginx/conf.d/default.conf +WORKDIR /app +COPY --from=build /app/publish . # Expose port 80 EXPOSE 80 -# Start nginx -CMD ["nginx", "-g", "daemon off;"] +# Set environment to production +ENV ASPNETCORE_ENVIRONMENT=Production +ENV ASPNETCORE_URLS=http://+:80 + +# Start the Blazor application +ENTRYPOINT ["dotnet", "SilverLabs.Website.dll"]