Deploying SKS Blazor migrated app to Azure Container Instances
Last updated
Last updated
This document provides a detailed guide for deploying SKS Blazor migrated applications using Azure Container Instances (ACI). It covers the necessary steps for setting up a local Docker environment, building container images, defining base images, and pushing images to container registries, specifically GitHub Container Registry (GHCR) and Azure Container Registry (ACR). Additionally, it includes instructions for creating and running containers in Azure, along with important considerations for ensuring successful deployment, particularly regarding the choice of base images and runtime dependencies for Windows-based applications.
To first build a Docker image with the SKS application is important to install and configure a local Docker runtime environment.
Add containers and hyper-v features on windows:
Open Windows Features:
Press Win + R, type optional features, and press Enter.
Or, search for "Turn Windows features on or off" in the Start menu and open it.
Enable Containers:
In the Windows Features dialog, scroll down and check the box for Containers.
Enable Hyper-V:
In the same list, find and check Hyper-V (expand it and ensure both "Hyper-V Management Tools" and "Hyper-V Platform" are checked).
Apply and Restart:
Click OK.
Windows will search for required files and apply changes.
Restart your computer when prompted.
Download Docker Desktop from:
Run the installer (Docker Desktop Installer.exe)
During installation:
Enable "Install required Windows components for WSL 2"
Enable "Use Windows containers instead of Linux containers"
Click "Ok" to install
Wait for installation to complete
Restart your computer
Run Docker desktop application.
Right click on Docker tray icon and select switch to windows containers (Since the images used to build the WebMap Blazor images are Windows OS based it’s necessary to work with Windows containers).
In settings verify that desktop-windows is running
The branch with the changes and the Dockerfile is: support/DockerContainerWindowsSKS.
Before creating the Dockerfile it’s important to define the base image used to create the container.
There a are 3 different types of base image the election should be based on the requirements:
Linux Images
Base OS: Linux (usually Debian or Alpine).
Size: Smallest.
Performance: Fast startup, low resource usage.
Compatibility:
Runs on Linux hosts (including most cloud/container platforms).
Cannot run Windows-specific workloads (e.g., Windows Forms, WPF, COM).
Best for:
Web apps (Blazor, ASP.NET Core, APIs).
Cloud-native deployments (Azure Container Apps, Kubernetes, Docker Hub).
Nano Server Images
Base OS: Windows Nano Server (minimal Windows kernel).
Size: Smaller than Server Core, larger than Linux.
Performance: Good, but not as fast or small as Linux.
Compatibility:
Runs only on Windows hosts (Windows containers).
No support for full .NET Framework, Windows Forms, WPF, or GDI+.
Only supports .NET Core/.NET 5+ console and web apps.
Best for:
.NET Core web apps that require Windows but not full Windows APIs.
Server Core Images
Base OS: Windows Server Core (more complete Windows environment).
Size: Largest.
Performance: Slower startup, higher resource usage.
Compatibility:
Runs only on Windows hosts (Windows containers).
Supports full .NET Framework, Windows Forms, WPF, GDI+, COM, etc.
Best for:
Legacy .NET Framework apps.
Apps needing full Windows APIs (desktop, GUI, COM, etc.).
Since most migrations come from windows architecture usually they are tightly coupled to windows environments, also WebMap Blazor code is compiled and designed to target Windows Desktop runtime that’s why the selected base image for the SKS POC is Server Core Images.
Once the based image is defined, a Dockerfile should be created to perform the image build. The Dockerfile used for this exercise can be found in the branch mentioned above.
After creating the Dockerfile, open a command line window pointing to the same folder where the dockerfile is and run the build command to generate an image.
You should have the image created in the docker desktop UI.
Then you can run the image locally as a container using the docker run command.
There should be a new container named sks_blazor_container created
Next step is to push the image to a Container registry so it can be run from the Azure Container instances app. But first you need to define which container registry to use.
These are some of the most common container registry options:
Git Hub Container Registry
Free for public repositories and generous free tier for private images.
No extra Azure cost (unlike ACR, which may incur charges after the free tier).
Easy integration with GitHub Actions for CI/CD.
Widely supported by Azure Container Apps and Azure Web App for Containers.
No vendor lock-in—you can use the same registry for other platforms.
Docker Hub
Free for public images (rate limits apply).
Simple to use and supported everywhere.
Private repositories are limited to the free tier.
Azure Container Registry
If you need enterprise features (private networking, managed identities, geo-replication).
If you want tight Azure integration and are comfortable with potential costs.
Using GHCR to push the image to the remote repository
Go to GitHub.com → Settings → Developer Settings → Personal Access Tokens → Tokens (classic).
Click "Generate new token (classic)"
Select the following scopes:
read:packages
write:packages
delete:packages (if you need to delete containers)
Copy the generated token
Login the local docker environment to GHCR:
Tag the image in GHCR:
Push the image
Using ACR to push the image to the remote repository
Open the Azure Portal
Go to https://portal.azure.com and sign in with your Azure account.
Open Azure Cloud Shell
In the top-right corner of the portal, click the Cloud Shell icon (it looks like a terminal or command prompt).
When prompted, select Bash as your shell environment.
If this is your first time, you may be asked to create a storage account—follow the prompts to set it up.
Create a resource group.
Create ACR
Go back to you local environment, open a cmd and login to azure.
For this exercise the SKS application was used. You can find the application along with the Dockerfile in the repo:
Image Example:
Image Example:
Image Example:
Since one of the ports exposed when running the container is 8080. The app will listen in