Click or drag to resize
Pdf Library for .NET

Deployment to Azure Container Apps

Azure Container Apps runs container images and scales them with the traffic, down to zero when idle. SelectPdf runs there in a Linux image built from the standard mcr.microsoft.com/dotnet/aspnet image, as its non-root user, with nothing installed.

The image

Reference the three packages in the application:

XML
<ItemGroup>
  <PackageReference Include="SelectPdf.HtmlToPdf.Universal" Version="26.4.0" />
  <PackageReference Include="SelectPdf.Universal.Native.linux-x64"
                    Version="26.4.0" />
  <PackageReference Include="SelectPdf.Universal.Fonts" Version="26.4.0" />
</ItemGroup>

and publish it into a .NET image:

FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish MyApp.csproj -c Release -o /app

FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build /app .
USER app
EXPOSE 8080
ENTRYPOINT ["dotnet", "MyApp.dll"]

See Deployment with Docker for more about images.

Step by step

1. Prepare the subscription (once):

az login
az extension add --name containerapp --upgrade
az provider register --namespace Microsoft.App --wait
az provider register --namespace Microsoft.OperationalInsights --wait

2. Create a resource group and a container registry, and push the image (the registry name is global):

az group create --name selectpdf-rg --location westeurope
az acr create --resource-group selectpdf-rg --name selectpdfregistry \
    --sku Basic --admin-enabled true
az acr login --name selectpdfregistry
docker build --platform linux/amd64 -t selectpdfregistry.azurecr.io/myapp:1 .
docker push selectpdfregistry.azurecr.io/myapp:1

3. Create the environment and wait until it reports Succeeded, which can take several minutes:

az containerapp env create --name selectpdf-env \
    --resource-group selectpdf-rg --location westeurope
az containerapp env show --name selectpdf-env --resource-group selectpdf-rg \
    --query properties.provisioningState

4. Create the container app:

az containerapp create --name selectpdf-app --resource-group selectpdf-rg \
    --environment selectpdf-env \
    --image selectpdfregistry.azurecr.io/myapp:1 \
    --registry-server selectpdfregistry.azurecr.io \
    --target-port 8080 --ingress external --cpu 2 --memory 4Gi \
    --min-replicas 0 --max-replicas 3 \
    --scale-rule-name http --scale-rule-type http \
    --scale-rule-http-concurrency 8
  • --cpu 2 --memory 4Gi is the largest consumption size; Chromium needs both.

  • --scale-rule-http-concurrency 8 starts another replica when one is converting 8 pages, the number SelectPdf converts at once by default.

  • --min-replicas 0 scales to zero when idle, and the first request then waits about 20 seconds for a replica to start. Use --min-replicas 1 to keep one ready.

What to expect

Measured in October 2026 (West Europe, consumption profile, 2 vCPU / 4 GiB): every conversion succeeded, every language rendered, and a warm replica converted selectpdf.com in about 1.3 seconds.

Sample

The official samples include this deployment, with a step-by-step README, in the cloud/azure-container-apps folder of the edition's samples.

See Also