fix: Change Dockerfile to run ASP.NET Core instead of static nginx

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 <noreply@anthropic.com>
This commit is contained in:
2025-10-20 19:28:01 +01:00
parent 3aa191cd3d
commit 62dc7bd93f
3 changed files with 13 additions and 10 deletions

3
.gitignore vendored
View File

@@ -29,6 +29,9 @@ bld/
# Backup folder
old-static-site/
# Publish output
publish/
# OS Files
.DS_Store
Thumbs.db

View File

@@ -16,8 +16,7 @@ if (!app.Environment.IsDevelopment())
app.UseHsts();
}
app.UseHttpsRedirection();
// app.UseHttpsRedirection(); // Disabled - running behind reverse proxy
app.UseAntiforgery();

View File

@@ -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"]