-
-
Save MoimHossain/482332913238db5b1577657de4cd4c10 to your computer and use it in GitHub Desktop.
A docker file that builds Blazor app and deploys in a Blob container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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