First cut of Docker files (#38)
- Fix canonical domain config detection (#37) - Fix version insert for new SQLite dbs - Bump version to 2.1
This commit is contained in:
parent
5b27ea5cd2
commit
5f5927c425
2
src/.dockerignore
Normal file
2
src/.dockerignore
Normal file
@ -0,0 +1,2 @@
|
||||
**/bin
|
||||
**/obj
|
@ -2,8 +2,8 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
<DebugType>embedded</DebugType>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
<FileVersion>2.0.0.0</FileVersion>
|
||||
<Version>2.0.0</Version>
|
||||
<AssemblyVersion>2.1.0.0</AssemblyVersion>
|
||||
<FileVersion>2.1.0.0</FileVersion>
|
||||
<Version>2.1.0</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
28
src/Dockerfile
Normal file
28
src/Dockerfile
Normal 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" ]
|
@ -210,7 +210,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
||||
// Database version table
|
||||
if needsTable "db_version" then
|
||||
"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 ->
|
||||
log.LogInformation $"Creating {(sql.Split ' ')[2]} table..."
|
||||
|
@ -203,8 +203,9 @@ let rec main args =
|
||||
|
||||
let _ = app.UseForwardedHeaders ()
|
||||
|
||||
let domainCfg = app.Services.GetRequiredService<IConfiguration>().GetSection "CanonicalDomains"
|
||||
if domainCfg.AsEnumerable().Count () > 0 then app.UseCanonicalDomains () |> ignore
|
||||
(app.Services.GetRequiredService<IConfiguration>().GetSection "CanonicalDomains").Value
|
||||
|> (isNull >> not)
|
||||
|> function true -> app.UseCanonicalDomains () |> ignore | false -> ()
|
||||
|
||||
let _ = app.UseCookiePolicy (CookiePolicyOptions (MinimumSameSitePolicy = SameSiteMode.Strict))
|
||||
let _ = app.UseMiddleware<WebLogMiddleware> ()
|
||||
|
Loading…
Reference in New Issue
Block a user