-
Notifications
You must be signed in to change notification settings - Fork 5
1015670: Sample on publishing the PDF Viewer component into the Azure Docker container #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Annotations | ||
| This section contains samples for publishing the Blazor Webapps sample into the Azure docker container | ||
|
|
||
| Documentation: https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/deployment/azure-container-deployment | ||
|
|
||
| ## Project pre-requisites | ||
| To run this application, you need Visual Studio 2019 or later versions. | ||
| An Azure subscription and permission to create resource groups, ACR instances, and App Services. | ||
|
|
||
| Note: Make sure to install the Wasm-tools and the workloads to make sure the pdf viewer component render properly in the Webapps Wasm sample. |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <Router AppAssembly="@typeof(App).Assembly" NotFoundPage="typeof(Pages.NotFound)"> | ||
| <Found Context="routeData"> | ||
| <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/> | ||
| <FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
| </Found> | ||
| </Router> |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base | ||
| RUN ln -s /lib/x86_64-linux-gnu/libdl-2.24.so /lib/x86_64-linux-gnu/libdl.so | ||
|
|
||
| # install System.Drawing native dependencies | ||
|
|
||
| RUN apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev | ||
|
|
||
| RUN ln -s libgdiplus.so gdiplus.dll | ||
| WORKDIR /app | ||
| EXPOSE 80 | ||
| EXPOSE 443 | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build | ||
| ## Install Python required for WASM tools | ||
| #RUN apt-get update && apt-get install -y \ | ||
|
sathiyaseelanksf3503 marked this conversation as resolved.
Outdated
|
||
| #python3 \ | ||
| #python3-pip \ | ||
| #python3-venv \ | ||
| #&& ln -s /usr/bin/python3 /usr/bin/python || true | ||
| ## Install WASM tools | ||
| #RUN dotnet workload install wasm-tools | ||
|
sathiyaseelanksf3503 marked this conversation as resolved.
Outdated
|
||
| WORKDIR /src | ||
| COPY ["NuGet.Config","/src/"] | ||
| COPY ["package", "/src/package"] | ||
|
|
||
| RUN dotnet nuget add source package | ||
| COPY ["WasmStandalone.csproj", "."] | ||
| RUN dotnet workload install wasm-tools | ||
| RUN apt-get update && apt-get install -y emscripten | ||
| RUN dotnet restore "WasmStandalone.csproj" --configfile "NuGet.Config" | ||
| COPY . . | ||
| RUN dotnet build "WasmStandalone.csproj" -c Release -o /app/build | ||
|
|
||
| FROM build AS publish | ||
| RUN dotnet publish "WasmStandalone.csproj" -c Release -o /app/publish | ||
|
|
||
| FROM nginx:alpine AS final | ||
| WORKDIR /usr/share/nginx/html | ||
| COPY --from=publish /app/publish/wwwroot . | ||
| COPY nginx.conf /etc/nginx/nginx.conf | ||
16 changes: 16 additions & 0 deletions
16
Azure Container/Web Assembly/WasmStandalone/Layout/MainLayout.razor
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| @inherits LayoutComponentBase | ||
| <div class="page"> | ||
| <div class="sidebar"> | ||
| <NavMenu /> | ||
| </div> | ||
|
|
||
| <main> | ||
| <div class="top-row px-4"> | ||
| <a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a> | ||
| </div> | ||
|
|
||
| <article class="content px-4"> | ||
| @Body | ||
| </article> | ||
| </main> | ||
| </div> |
77 changes: 77 additions & 0 deletions
77
Azure Container/Web Assembly/WasmStandalone/Layout/MainLayout.razor.css
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| .page { | ||
| position: relative; | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| main { | ||
| flex: 1; | ||
| } | ||
|
|
||
| .sidebar { | ||
| background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); | ||
| } | ||
|
|
||
| .top-row { | ||
| background-color: #f7f7f7; | ||
| border-bottom: 1px solid #d6d5d5; | ||
| justify-content: flex-end; | ||
| height: 3.5rem; | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .top-row ::deep a, .top-row ::deep .btn-link { | ||
| white-space: nowrap; | ||
| margin-left: 1.5rem; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| .top-row ::deep a:first-child { | ||
| overflow: hidden; | ||
| text-overflow: ellipsis; | ||
| } | ||
|
|
||
| @media (max-width: 640.98px) { | ||
| .top-row { | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .top-row ::deep a, .top-row ::deep .btn-link { | ||
| margin-left: 0; | ||
| } | ||
| } | ||
|
|
||
| @media (min-width: 641px) { | ||
| .page { | ||
| flex-direction: row; | ||
| } | ||
|
|
||
| .sidebar { | ||
| width: 250px; | ||
| height: 100vh; | ||
| position: sticky; | ||
| top: 0; | ||
| } | ||
|
|
||
| .top-row { | ||
| position: sticky; | ||
| top: 0; | ||
| z-index: 1; | ||
| } | ||
|
|
||
| .top-row.auth ::deep a:first-child { | ||
| flex: 1; | ||
| text-align: right; | ||
| width: 0; | ||
| } | ||
|
|
||
| .top-row, article { | ||
| padding-left: 2rem !important; | ||
| padding-right: 1.5rem !important; | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
Azure Container/Web Assembly/WasmStandalone/Layout/NavMenu.razor
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <div class="top-row ps-3 navbar navbar-dark"> | ||
| <div class="container-fluid"> | ||
| <a class="navbar-brand" href="">WasmStandalone</a> | ||
| <button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu"> | ||
| <span class="navbar-toggler-icon"></span> | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu"> | ||
| <nav class="nav flex-column"> | ||
| <div class="nav-item px-3"> | ||
| <NavLink class="nav-link" href="" Match="NavLinkMatch.All"> | ||
| <span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home | ||
| </NavLink> | ||
| </div> | ||
| <div class="nav-item px-3"> | ||
| <NavLink class="nav-link" href="counter"> | ||
| <span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter | ||
| </NavLink> | ||
| </div> | ||
| <div class="nav-item px-3"> | ||
| <NavLink class="nav-link" href="weather"> | ||
| <span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather | ||
| </NavLink> | ||
| </div> | ||
| </nav> | ||
| </div> | ||
|
|
||
| @code { | ||
| private bool collapseNavMenu = true; | ||
|
|
||
| private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; | ||
|
|
||
| private void ToggleNavMenu() | ||
| { | ||
| collapseNavMenu = !collapseNavMenu; | ||
| } | ||
| } |
83 changes: 83 additions & 0 deletions
83
Azure Container/Web Assembly/WasmStandalone/Layout/NavMenu.razor.css
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| .navbar-toggler { | ||
| background-color: rgba(255, 255, 255, 0.1); | ||
| } | ||
|
|
||
| .top-row { | ||
| min-height: 3.5rem; | ||
| background-color: rgba(0,0,0,0.4); | ||
| } | ||
|
|
||
| .navbar-brand { | ||
| font-size: 1.1rem; | ||
| } | ||
|
|
||
| .bi { | ||
| display: inline-block; | ||
| position: relative; | ||
| width: 1.25rem; | ||
| height: 1.25rem; | ||
| margin-right: 0.75rem; | ||
| top: -1px; | ||
| background-size: cover; | ||
| } | ||
|
|
||
| .bi-house-door-fill-nav-menu { | ||
| background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E"); | ||
| } | ||
|
|
||
| .bi-plus-square-fill-nav-menu { | ||
| background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E"); | ||
| } | ||
|
|
||
| .bi-list-nested-nav-menu { | ||
| background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E"); | ||
| } | ||
|
|
||
| .nav-item { | ||
| font-size: 0.9rem; | ||
| padding-bottom: 0.5rem; | ||
| } | ||
|
|
||
| .nav-item:first-of-type { | ||
| padding-top: 1rem; | ||
| } | ||
|
|
||
| .nav-item:last-of-type { | ||
| padding-bottom: 1rem; | ||
| } | ||
|
|
||
| .nav-item ::deep a { | ||
| color: #d7d7d7; | ||
| border-radius: 4px; | ||
| height: 3rem; | ||
| display: flex; | ||
| align-items: center; | ||
| line-height: 3rem; | ||
| } | ||
|
|
||
| .nav-item ::deep a.active { | ||
| background-color: rgba(255,255,255,0.37); | ||
| color: white; | ||
| } | ||
|
|
||
| .nav-item ::deep a:hover { | ||
| background-color: rgba(255,255,255,0.1); | ||
| color: white; | ||
| } | ||
|
|
||
| @media (min-width: 641px) { | ||
| .navbar-toggler { | ||
| display: none; | ||
| } | ||
|
|
||
| .collapse { | ||
| /* Never collapse the sidebar for wide screens */ | ||
| display: block; | ||
| } | ||
|
|
||
| .nav-scrollable { | ||
| /* Allow sidebar to scroll for tall menus */ | ||
| height: calc(100vh - 3.5rem); | ||
| overflow-y: auto; | ||
| } | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <packageSources> | ||
| <clear /> | ||
| <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | ||
| </packageSources> | ||
| <activePackageSource> | ||
| <add key="All" value="(Aggregate source)" /> | ||
| </activePackageSource> | ||
| </configuration> |
18 changes: 18 additions & 0 deletions
18
Azure Container/Web Assembly/WasmStandalone/Pages/Counter.razor
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| @page "/counter" | ||
|
|
||
| <PageTitle>Counter</PageTitle> | ||
|
|
||
| <h1>Counter</h1> | ||
|
|
||
| <p role="status">Current count: @currentCount</p> | ||
|
|
||
| <button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | ||
|
|
||
| @code { | ||
| private int currentCount = 0; | ||
|
|
||
| private void IncrementCount() | ||
| { | ||
| currentCount++; | ||
| } | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| @page "/" | ||
|
|
||
| <SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf" | ||
| Height="100%" | ||
| Width="100%"> | ||
| </SfPdfViewer2> |
5 changes: 5 additions & 0 deletions
5
Azure Container/Web Assembly/WasmStandalone/Pages/NotFound.razor
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| @page "/not-found" | ||
| @layout MainLayout | ||
|
|
||
| <h3>Not Found</h3> | ||
| <p>Sorry, the content you are looking for does not exist.</p> |
57 changes: 57 additions & 0 deletions
57
Azure Container/Web Assembly/WasmStandalone/Pages/Weather.razor
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| @page "/weather" | ||
| @inject HttpClient Http | ||
|
|
||
| <PageTitle>Weather</PageTitle> | ||
|
|
||
| <h1>Weather</h1> | ||
|
|
||
| <p>This component demonstrates fetching data from the server.</p> | ||
|
|
||
| @if (forecasts == null) | ||
| { | ||
| <p><em>Loading...</em></p> | ||
| } | ||
| else | ||
| { | ||
| <table class="table"> | ||
| <thead> | ||
| <tr> | ||
| <th>Date</th> | ||
| <th aria-label="Temperature in Celsius">Temp. (C)</th> | ||
| <th aria-label="Temperature in Fahrenheit">Temp. (F)</th> | ||
| <th>Summary</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| @foreach (var forecast in forecasts) | ||
| { | ||
| <tr> | ||
| <td>@forecast.Date.ToShortDateString()</td> | ||
| <td>@forecast.TemperatureC</td> | ||
| <td>@forecast.TemperatureF</td> | ||
| <td>@forecast.Summary</td> | ||
| </tr> | ||
| } | ||
| </tbody> | ||
| </table> | ||
| } | ||
|
|
||
| @code { | ||
| private WeatherForecast[]? forecasts; | ||
|
|
||
| protected override async Task OnInitializedAsync() | ||
| { | ||
| forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json"); | ||
| } | ||
|
|
||
| public class WeatherForecast | ||
| { | ||
| public DateOnly Date { get; set; } | ||
|
|
||
| public int TemperatureC { get; set; } | ||
|
|
||
| public string? Summary { get; set; } | ||
|
|
||
| public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | ||
| } | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| using Microsoft.AspNetCore.Components.Web; | ||
| using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||
| using WasmStandalone; | ||
| using Syncfusion.Blazor; | ||
|
|
||
| var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
| builder.RootComponents.Add<App>("#app"); | ||
| builder.RootComponents.Add<HeadOutlet>("head::after"); | ||
| builder.Services.AddMemoryCache(); | ||
| builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); | ||
| builder.Services.AddSyncfusionBlazor(); | ||
| await builder.Build().RunAsync(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.