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:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -29,6 +29,9 @@ bld/
|
||||
# Backup folder
|
||||
old-static-site/
|
||||
|
||||
# Publish output
|
||||
publish/
|
||||
|
||||
# OS Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
@@ -16,8 +16,7 @@ if (!app.Environment.IsDevelopment())
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
// app.UseHttpsRedirection(); // Disabled - running behind reverse proxy
|
||||
|
||||
app.UseAntiforgery();
|
||||
|
||||
|
||||
17
Dockerfile
17
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"]
|
||||
|
||||
Reference in New Issue
Block a user