Skip to content

Commit 241e04f

Browse files
committedMar 26, 2023
Completed Blazor WASM Dockerizing
1 parent fe61a17 commit 241e04f

11 files changed

+449
-3
lines changed
 

‎SharedModels/BlazorLearningPath.cs

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
public class BlazorLearningPath
44
{
5-
public readonly List<ContentMetaData> FullContents = new(20);
5+
public readonly List<ContentMetaData> FullContents = new(21);
66

77
public BlazorLearningPath()
88
{
99
FullContents =
10-
new(20)
10+
new(21)
1111
{
1212
new ContentMetaData
1313
{
@@ -268,6 +268,19 @@ public BlazorLearningPath()
268268
Type = "Blazor",
269269
CreatedOn = new DateTime(2022, 8, 7, 22, 30, 0),
270270
ModifiedOn = new DateTime(2022, 8, 7, 22, 30, 0)
271+
},
272+
new ContentMetaData
273+
{
274+
Order = 21,
275+
Title = "Blazor WASM Dockerizing",
276+
Author = "Abdul Rahman",
277+
PosterUrl = "image/blogs/blazor/wasm/blazor-wasm-dockerizing.svg",
278+
ThumbnailUrl = "image/blogs/blazor/wasm/blazor-wasm-dockerizing.svg",
279+
ContentUrl = "blogs/blazor-wasm-dockerizing",
280+
IconUrl = "image/icons/blazor.png",
281+
Type = "Blazor",
282+
CreatedOn = new DateTime(2023, 3, 26, 22, 30, 0),
283+
ModifiedOn = new DateTime(2023, 3, 26, 22, 30, 0)
271284
}
272285
};
273286
}

‎SharedModels/TableOfContents.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class TableOfContents
44
{
5-
private readonly List<ContentMetaData> FullContents = new(62);
5+
private readonly List<ContentMetaData> FullContents = new(63);
66
public IReadOnlyList<ContentMetaData> Contents => FullContents.Where(content => content.CreatedOn.Date <= DateTime.Today.Date).ToList();
77

88
public TableOfContents()

‎Web/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build-env
2+
RUN apk add nodejs
3+
RUN apk add npm
4+
WORKDIR /app
5+
COPY . ./
6+
RUN npm --prefix Web install
7+
RUN dotnet publish "Web/Web.csproj" -c Release -o output
8+
9+
FROM nginx:alpine
10+
WORKDIR /user/share/nginx/html
11+
COPY --from=build-env /app/output/wwwroot .
12+
COPY Web/nginx.conf /etc/nginx/nginx.conf
13+
EXPOSE 80

‎Web/Pages/Blogs/Blazor/Wasm/Dockerizing.razor

+378
Large diffs are not rendered by default.

‎Web/nginx.conf

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
events { }
2+
http {
3+
include mime.types;
4+
types {
5+
application/wasm;
6+
}
7+
server {
8+
listen 80;
9+
index index.html;
10+
location / {
11+
root /user/share/nginx/html;
12+
try_files $uri $uri/ /index.html =404;
13+
}
14+
}
15+
}

‎Web/wwwroot/atom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -438,5 +438,12 @@
438438
<description>In this post I will teach you Creational Singleton Design Pattern in .NET. All with live working demo.</description>
439439
<pubDate>Sun, 19 Mar 2023 22:30:00 +0530</pubDate>
440440
</item>
441+
<item>
442+
<title>Blazor WASM Dockerizing</title>
443+
<link>https://ilovedotnet.org/blogs/blazor-wasm-dockerizing</link>
444+
<guid isPermaLink="true">https://ilovedotnet.org/blogs/blazor-wasm-dockerizing</guid>
445+
<description>In this post I will teach you how to dockerize stand alone blazor wasm app in .NET. All with live working demo.</description>
446+
<pubDate>Sun, 26 Mar 2023 22:30:00 +0530</pubDate>
447+
</item>
441448
</channel>
442449
</rss>
Loading

‎Web/wwwroot/image/blogs/blazor/wasm/blazor-wasm-dockerizing.svg

+1
Loading
Loading

‎Web/wwwroot/sitemap-blog-blazor-wasm.xml

+6
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,10 @@
120120
<changefreq>weekly</changefreq>
121121
<priority>0.5</priority>
122122
</url>
123+
<url>
124+
<loc>https://ilovedotnet.org/blogs/blazor-wasm-dockerizing</loc>
125+
<lastmod>2023-03-26T22:30:00+05:30</lastmod>
126+
<changefreq>weekly</changefreq>
127+
<priority>0.5</priority>
128+
</url>
123129
</urlset>

‎docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.7'
2+
3+
services:
4+
ilovedotnet:
5+
image: ilovedotnet
6+
build:
7+
context: .
8+
dockerfile: Web/Dockerfile
9+
environment:
10+
- ASPNETCORE_URLS=http://*:5005
11+
- ASPNETCORE_ENVIRONMENT=Development
12+
ports:
13+
- "8080:80"

0 commit comments

Comments
 (0)
Please sign in to comment.