Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A docker file that builds Blazor app and deploys in a Blob container
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
# Build the app
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY . .
WORKDIR "/src/BlazorApp"
RUN dotnet restore "BlazorApp.csproj"
RUN dotnet build "BlazorApp.csproj" -c Release -o /app
# Run the unit tests
RUN dotnet restore "BlazorAppTest.csproj"
RUN dotnet build "BlazorAppTest.csproj"
RUN dotnet test "BlazorAppTest.csproj"
# Publish the app
FROM build AS publish
RUN dotnet publish "BlazorApp.csproj" -c Release -o /app
FROM microsoft/azure-cli AS final
ARG AppID
ARG AppSecret
ARG TenantID
ARG StorageAccountName
WORKDIR /app
COPY --from=publish /app .
WORKDIR "/app/BlazorApp/dist"
RUN az login --service-principal --username $AppID --password $AppSecret --tenant $TenantID
RUN az storage blob delete-batch --account-name $StorageAccountName --source "\$web"
RUN az storage blob upload-batch --account-name $StorageAccountName -s . -d "\$web"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.