.Net 8 Blazor Static SSR Deploying

I started learning Blazor and now I’m trying to deploy a Blazor static SSR (Server-Side Rendering) app, but I can’t find any resources that explain how to do it. I successfully deployed a Blazor WebAssembly app by following instructions at, but for static SSR, I can’t find anything. Can someone direct me to a link or write out the process here? I am using .Net 8.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 12, 2024


Indeed, deploying a Blazor SSR app involves a different approach compared to a Blazor WebAssembly app, mainly because a Blazor SSR app requires a server component to handle the rendering and serve the app to clients. Unlike WebAssembly apps, which are purely static and can be served from any static file hosting, Blazor SSR apps need a backend environment capable of running .NET applications.

Since DigitalOcean doesn’t offer a native buildpack for .NET, using Docker is a great way to get your .NET 8 Blazor app running smoothly on the platform.

Step 1: Create a Dockerfile

First, you need a Dockerfile in the root of your Blazor SSR project. This file defines how your app will be built and run in a Docker container. Here’s a simple example:

# Use the official .NET core runtime as a parent image
FROM AS base

# Use the SDK image to build the app
FROM AS build
COPY ["YourBlazorApp.csproj", "./"]
RUN dotnet restore "./YourBlazorApp.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "YourBlazorApp.csproj" -c Release -o /app/build

# Publish the app
FROM build AS publish
RUN dotnet publish "YourBlazorApp.csproj" -c Release -o /app/publish

# Final stage/image
FROM base AS final
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "YourBlazorApp.dll"]

Replace YourBlazorApp.csproj and YourBlazorApp.dll with your actual project and DLL names.

Step 2: Push Your Code to GitHub

Make sure your project, along with the Dockerfile, is pushed to your GitHub repository.

Step 3: Set Up on DigitalOcean App Platform

Go to your DigitalOcean dashboard and create a new app. Choose GitHub as the source and select the repository you just pushed.

Step 4: Configure the Build and Deploy Process

Since you’re using Docker, DigitalOcean will automatically detect the Dockerfile and use it for the build and deployment process. Just make sure that your Dockerfile is set up correctly as shown in Step 1.

Step 5: Launch the App

Once everything is set up, click “Launch.” DigitalOcean will take care of pulling your code from GitHub, building it using the Dockerfile, and deploying it.

After deployment, visit the provided URL to see your Blazor SSR app in action.

In addition to that here are some general tips:

  • If something doesn’t work as expected, check the build logs in the DigitalOcean App Platform for any errors.
  • Ensure that your Dockerfile is correctly configured to expose the right port (typically 80 for web apps).
  • Remember, Blazor SSR apps require a server backend, so testing your app in a local Docker environment before deploying can save you a lot of time.

That’s pretty much it! Using Docker provides a lot of flexibility and ensures that your environment is consistent across development and production. Happy coding and let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel