From 622ed0b3fcd37937163d9ffbcdc7d3132fbd6466 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 3 Jul 2023 23:17:40 -0400 Subject: [PATCH] Add Dockerfile - Bump runtime version - Bump application version --- build.fsx | 2 +- src/Directory.Build.props | 8 +++--- src/Dockerfile | 25 +++++++++++++++++++ .../PrayerTracker.Data.fsproj | 4 --- .../PrayerTracker.Tests.fsproj | 1 - src/PrayerTracker.Tests/UI/ViewModelsTests.fs | 4 +-- src/PrayerTracker.UI/PrayerTracker.UI.fsproj | 4 --- src/PrayerTracker/PrayerTracker.fsproj | 2 +- src/PrayerTracker/User.fs | 2 ++ 9 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 src/Dockerfile diff --git a/build.fsx b/build.fsx index 50b9aa1..552973c 100644 --- a/build.fsx +++ b/build.fsx @@ -26,7 +26,7 @@ Target.create "Test" (fun _ -> let testPath = $"{projPath}.Tests" DotNet.build (fun opts -> { opts with NoLogo = true }) $"{testPath}/PrayerTracker.Tests.fsproj" 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" ]) Target.create "Publish" (fun _ -> diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d54687e..d0aaa2c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,11 +1,11 @@ - net6.0 - 8.0.0.0 - 8.0.0.0 + net7.0 + 8.1.0.0 + 8.1.0.0 danieljsummers Bit Badger Solutions - 8.0.0 + 8.1.0 Embedded diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 0000000..d652e29 --- /dev/null +++ b/src/Dockerfile @@ -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" ] diff --git a/src/PrayerTracker.Data/PrayerTracker.Data.fsproj b/src/PrayerTracker.Data/PrayerTracker.Data.fsproj index 40cae83..62c1310 100644 --- a/src/PrayerTracker.Data/PrayerTracker.Data.fsproj +++ b/src/PrayerTracker.Data/PrayerTracker.Data.fsproj @@ -1,9 +1,5 @@  - - net6.0 - - diff --git a/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj b/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj index e98224a..615831a 100644 --- a/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj +++ b/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj @@ -2,7 +2,6 @@ Exe - net6.0 diff --git a/src/PrayerTracker.Tests/UI/ViewModelsTests.fs b/src/PrayerTracker.Tests/UI/ViewModelsTests.fs index 0ba5f54..739fa0c 100644 --- a/src/PrayerTracker.Tests/UI/ViewModelsTests.fs +++ b/src/PrayerTracker.Tests/UI/ViewModelsTests.fs @@ -650,7 +650,7 @@ let requestListTests = } let text = textList.AsText _s 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)" // spot check; if one request has it, they all should Expect.stringContains text expected "Expected short as-of date not found" @@ -665,7 +665,7 @@ let requestListTests = } let text = textList.AsText _s 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)" // spot check; if one request has it, they all should Expect.stringContains text expected "Expected long as-of date not found" diff --git a/src/PrayerTracker.UI/PrayerTracker.UI.fsproj b/src/PrayerTracker.UI/PrayerTracker.UI.fsproj index 8a976c0..73b5564 100644 --- a/src/PrayerTracker.UI/PrayerTracker.UI.fsproj +++ b/src/PrayerTracker.UI/PrayerTracker.UI.fsproj @@ -1,9 +1,5 @@  - - net6.0 - - diff --git a/src/PrayerTracker/PrayerTracker.fsproj b/src/PrayerTracker/PrayerTracker.fsproj index 6864a3d..c08fc7d 100644 --- a/src/PrayerTracker/PrayerTracker.fsproj +++ b/src/PrayerTracker/PrayerTracker.fsproj @@ -2,7 +2,7 @@ Exe - True + False False diff --git a/src/PrayerTracker/User.fs b/src/PrayerTracker/User.fs index 56b865b..3aa0076 100644 --- a/src/PrayerTracker/User.fs +++ b/src/PrayerTracker/User.fs @@ -9,6 +9,8 @@ open PrayerTracker.Data open PrayerTracker.Entities 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 [] module Hashing =