Version 2.1 #41

Merged
danieljsummers merged 123 commits from version-2.1 into main 2024-03-27 00:13:28 +00:00
5 changed files with 37 additions and 6 deletions
Showing only changes of commit 5f5927c425 - Show all commits

2
src/.dockerignore Normal file
View File

@ -0,0 +1,2 @@
**/bin
**/obj

View File

@ -2,8 +2,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks> <TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<DebugType>embedded</DebugType> <DebugType>embedded</DebugType>
<AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion> <FileVersion>2.1.0.0</FileVersion>
<Version>2.0.0</Version> <Version>2.1.0</Version>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

28
src/Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /mwl
COPY ./MyWebLog.sln ./
COPY ./Directory.Build.props ./
COPY ./MyWebLog/MyWebLog.fsproj ./MyWebLog/
COPY ./MyWebLog.Data/MyWebLog.Data.fsproj ./MyWebLog.Data/
COPY ./MyWebLog.Domain/MyWebLog.Domain.fsproj ./MyWebLog.Domain/
RUN dotnet restore
COPY . ./
WORKDIR /mwl/MyWebLog
RUN dotnet publish -f net7.0 -c Release -r linux-x64
FROM alpine AS theme
RUN apk add --no-cache zip
WORKDIR /themes
COPY ./default-theme ./default-theme/
RUN zip default-theme.zip ./default-theme/*
COPY ./admin-theme ./admin-theme/
RUN zip admin-theme.zip ./admin-theme/*
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as final
WORKDIR /app
COPY --from=build /mwl/MyWebLog/bin/Release/net7.0/linux-x64/publish/ ./
COPY --from=theme /themes/*.zip /app/
EXPOSE 80
CMD [ "/app/MyWebLog" ]

View File

@ -210,7 +210,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
// Database version table // Database version table
if needsTable "db_version" then if needsTable "db_version" then
"CREATE TABLE db_version (id TEXT PRIMARY KEY); "CREATE TABLE db_version (id TEXT PRIMARY KEY);
INSERT INTO db_version VALUES ('v2-rc1')" INSERT INTO db_version VALUES ('v2')"
} }
|> Seq.map (fun sql -> |> Seq.map (fun sql ->
log.LogInformation $"Creating {(sql.Split ' ')[2]} table..." log.LogInformation $"Creating {(sql.Split ' ')[2]} table..."

View File

@ -203,8 +203,9 @@ let rec main args =
let _ = app.UseForwardedHeaders () let _ = app.UseForwardedHeaders ()
let domainCfg = app.Services.GetRequiredService<IConfiguration>().GetSection "CanonicalDomains" (app.Services.GetRequiredService<IConfiguration>().GetSection "CanonicalDomains").Value
if domainCfg.AsEnumerable().Count () > 0 then app.UseCanonicalDomains () |> ignore |> (isNull >> not)
|> function true -> app.UseCanonicalDomains () |> ignore | false -> ()
let _ = app.UseCookiePolicy (CookiePolicyOptions (MinimumSameSitePolicy = SameSiteMode.Strict)) let _ = app.UseCookiePolicy (CookiePolicyOptions (MinimumSameSitePolicy = SameSiteMode.Strict))
let _ = app.UseMiddleware<WebLogMiddleware> () let _ = app.UseMiddleware<WebLogMiddleware> ()