Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/
obj/
*.db
/packages/
riderModule.iml
/_ReSharper.Caches/
Expand Down
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src/LinkDotNet.Blog.Web
COPY ./ /
RUN dotnet restore "LinkDotNet.Blog.Web.csproj"
RUN dotnet build "LinkDotNet.Blog.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "LinkDotNet.Blog.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LinkDotNet.Blog.Web.dll"]
19 changes: 19 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,22 @@ Furthermore, the following tags are set:

## RSS Feed
This blog also offers an RSS feed ([RSS 2.0 specification](https://validator.w3.org/feed/docs/rss2.html)), which can be consumed by your users or programs like Feedly. Just append `feed.rss` to your URL or click on the RSS feed icon in the navigation bar to get the feed. The RSS feed does not expose the whole content of a given blog post but its title and short description including some other tags like preview image, publishing date and so on.

## Host Web in Docker containers

To deploy with docker, you need to modify the variables in the docker-compose.yml file.
```yml
volumes:
- /root/.aspnet/DataProtection-Keys:/root/.aspnet/DataProtection-Keys
- ./Blog.db:/app/Blog.db #SQlite datebase consistent with appsettings.json
- /root/aspnetapp.pfx:/app/aspnetapp.pfx #ssl certificate
environment:
- ASPNETCORE_URLS=http://+:80;https://+:443
- ASPNETCORE_HTTPS_PORT=80
- ASPNETCORE_Kestrel__Certificates__Default__Password= #your certificate password
- ASPNETCORE_Kestrel__Certificates__Default__Path=/app/aspnetapp.pfx
- ASPNETCORE_ENVIRONMENT=Production
```
After modifying the settings, you can use the docker command`docker compose up -d`
Deploy the web.
If you don't use HTTPS, you can remove the related options.
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
dotnet:
image: linkdotnet.blog.web
build: ./
container_name: dotnetBlog
ports:
- 80:80 #You can modify the port you want
- 443:443
volumes:
- /root/.aspnet/DataProtection-Keys:/root/.aspnet/DataProtection-Keys
- ./Blog.db:/app/Blog.db #SQlite datebase
- /root/aspnetapp.pfx:/app/aspnetapp.pfx #ssl certificate
environment:
- ASPNETCORE_URLS=http://+:80;https://+:443
- ASPNETCORE_HTTPS_PORT=80
- ASPNETCORE_Kestrel__Certificates__Default__Password= #your certificate password
- ASPNETCORE_Kestrel__Certificates__Default__Path=/app/aspnetapp.pfx
- ASPNETCORE_ENVIRONMENT=Production