Add Dockerfile

- Bump runtime version
- Bump application version
This commit is contained in:
Daniel J. Summers 2023-07-03 23:17:40 -04:00
parent 370fbb0c3e
commit 622ed0b3fc
9 changed files with 35 additions and 17 deletions

View File

@ -26,7 +26,7 @@ Target.create "Test" (fun _ ->
let testPath = $"{projPath}.Tests" let testPath = $"{projPath}.Tests"
DotNet.build (fun opts -> { opts with NoLogo = true }) $"{testPath}/PrayerTracker.Tests.fsproj" DotNet.build (fun opts -> { opts with NoLogo = true }) $"{testPath}/PrayerTracker.Tests.fsproj"
Expecto.run Expecto.run
(fun opts -> { opts with WorkingDirectory = $"{testPath}/bin/Release/net6.0" }) (fun opts -> { opts with WorkingDirectory = $"{testPath}/bin/Release/net7.0" })
[ "PrayerTracker.Tests.dll" ]) [ "PrayerTracker.Tests.dll" ])
Target.create "Publish" (fun _ -> Target.create "Publish" (fun _ ->

View File

@ -1,11 +1,11 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<AssemblyVersion>8.0.0.0</AssemblyVersion> <AssemblyVersion>8.1.0.0</AssemblyVersion>
<FileVersion>8.0.0.0</FileVersion> <FileVersion>8.1.0.0</FileVersion>
<Authors>danieljsummers</Authors> <Authors>danieljsummers</Authors>
<Company>Bit Badger Solutions</Company> <Company>Bit Badger Solutions</Company>
<Version>8.0.0</Version> <Version>8.1.0</Version>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

25
src/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
WORKDIR /pt
COPY ./PrayerTracker.sln ./
COPY ./Directory.Build.props ./
COPY ./PrayerTracker/PrayerTracker.fsproj ./PrayerTracker/
COPY ./PrayerTracker.Data/PrayerTracker.Data.fsproj ./PrayerTracker.Data/
COPY ./PrayerTracker.Tests/PrayerTracker.Tests.fsproj ./PrayerTracker.Tests/
COPY ./PrayerTracker.UI/PrayerTracker.UI.fsproj ./PrayerTracker.UI/
RUN dotnet restore
COPY . ./
WORKDIR /pt/PrayerTracker.Tests
RUN dotnet run
WORKDIR /pt/PrayerTracker
RUN dotnet publish -c Release -r linux-x64
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine as final
WORKDIR /app
RUN apk add --no-cache icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
COPY --from=build /pt/PrayerTracker/bin/Release/net7.0/linux-x64/publish/ ./
EXPOSE 80
CMD [ "dotnet", "/app/PrayerTracker.dll" ]

View File

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Entities.fs" /> <Compile Include="Entities.fs" />
<Compile Include="Access.fs" /> <Compile Include="Access.fs" />

View File

@ -2,7 +2,6 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -650,7 +650,7 @@ let requestListTests =
} }
let text = textList.AsText _s let text = textList.AsText _s
let expected = let expected =
textList.Requests[0].UpdatedDate.InUtc().Date.ToString ("d", null) textList.Requests[0].UpdatedDate.InZone(SmallGroup.timeZone reqList.SmallGroup).Date.ToString ("d", null)
|> sprintf " + Zeb - zyx (as of %s)" |> sprintf " + Zeb - zyx (as of %s)"
// spot check; if one request has it, they all should // spot check; if one request has it, they all should
Expect.stringContains text expected "Expected short as-of date not found" Expect.stringContains text expected "Expected short as-of date not found"
@ -665,7 +665,7 @@ let requestListTests =
} }
let text = textList.AsText _s let text = textList.AsText _s
let expected = let expected =
textList.Requests[0].UpdatedDate.InUtc().Date.ToString ("D", null) textList.Requests[0].UpdatedDate.InZone(SmallGroup.timeZone reqList.SmallGroup).Date.ToString ("D", null)
|> sprintf " + Zeb - zyx (as of %s)" |> sprintf " + Zeb - zyx (as of %s)"
// spot check; if one request has it, they all should // spot check; if one request has it, they all should
Expect.stringContains text expected "Expected long as-of date not found" Expect.stringContains text expected "Expected long as-of date not found"

View File

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Utils.fs" /> <Compile Include="Utils.fs" />
<Compile Include="ViewModels.fs" /> <Compile Include="ViewModels.fs" />

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>False</PublishSingleFile>
<SelfContained>False</SelfContained> <SelfContained>False</SelfContained>
</PropertyGroup> </PropertyGroup>

View File

@ -9,6 +9,8 @@ open PrayerTracker.Data
open PrayerTracker.Entities open PrayerTracker.Entities
open PrayerTracker.ViewModels open PrayerTracker.ViewModels
#nowarn "44" // The default Rfc2898DeriveBytes is used to identify passwords to be upgraded
/// Password hashing implementation extending ASP.NET Core's identity implementation /// Password hashing implementation extending ASP.NET Core's identity implementation
[<AutoOpen>] [<AutoOpen>]
module Hashing = module Hashing =