diff --git a/.gitignore b/.gitignore
index 69a8be8..336edb8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@
.idea
bin
obj
+build
*.DotSettings.user
diff --git a/Build/Build.fsproj b/Build/Build.fsproj
deleted file mode 100644
index 0f6adb5..0000000
--- a/Build/Build.fsproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net8.0
- Exe
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Build/src/Deploy.fs b/Build/src/Deploy.fs
deleted file mode 100644
index 2fcaf69..0000000
--- a/Build/src/Deploy.fs
+++ /dev/null
@@ -1,27 +0,0 @@
-[]
-module Deploy
-
-open Fake.Core
-open Support
-
-let private herokuBinary = if Environment.isWindows then "heroku.cmd" else "heroku"
-
-let private deploy project herokuApp _ =
- let publishDir = $"%s{project}/bin/Release/net8.0/linux-x64/publish"
-
- DotNet.release project ()
-
- File.write $"%s{publishDir}/Procfile" $"web: chmod 755 %s{project} && ./%s{project}"
-
- let buildOptions =
- if Environment.isMacOS then
- "--tar /opt/homebrew/bin/gtar"
- else
- ""
-
- Proc.exec (cmd = $"%s{herokuBinary} builds:create -a %s{herokuApp} %s{buildOptions}", pwd = publishDir)
-
-let loadTasks _ =
- Target.create "deploy" (deploy "Damo.Io.Server" "damo-io")
-
- "deploy" |> Target.dependsOn [ "release" ]
diff --git a/Build/src/DotNet.fs b/Build/src/DotNet.fs
deleted file mode 100644
index d1e2180..0000000
--- a/Build/src/DotNet.fs
+++ /dev/null
@@ -1,46 +0,0 @@
-[]
-module DotNet
-
-open System.IO
-
-let private dotnet command = Proc.exec $"dotnet %s{command}"
-
-let build _ = dotnet "build"
-
-let test _ = dotnet "test"
-
-let release project _ =
- dotnet $"publish %s{project} -c Release -r linux-x64 --self-contained"
-
-type Project(name: string) =
-
- let subDirPath dir = $"{name}/{dir}"
- let subDir = subDirPath >> DirectoryInfo
-
- member _.buildDirs = [ "bin"; "obj" ] |> List.map subDir
-
- member _.srcDirPath = subDirPath "src"
-
-[]
-type Solution(fileName: string) =
- member self.projects =
- File.ReadAllLines(fileName)
- |> Array.filter (fun line -> line.StartsWith("Project"))
- |> Array.map (fun line -> Array.get (line.Split "=") 1)
- |> Array.map (fun line -> Array.get (line.Split ",") 0)
- |> Array.map (fun line -> line.Trim().Replace("\"", ""))
- |> Array.map Project
- |> Array.toList
-
- member self.buildDirs = self.projects |> List.collect _.buildDirs
-
- member self.srcDirPaths = self.projects |> List.map _.srcDirPath
-
-let clean _ =
- let sln = Solution("SoManyFeeds.sln")
-
- sln.buildDirs
- |> List.filter (fun dir -> dir.Exists)
- |> List.filter (fun dir -> dir.Parent.Name <> "Build")
- |> List.map (fun dir -> dir.Delete true)
- |> ignore
diff --git a/Build/src/Fantomas.fs b/Build/src/Fantomas.fs
deleted file mode 100644
index d9b9d14..0000000
--- a/Build/src/Fantomas.fs
+++ /dev/null
@@ -1,6 +0,0 @@
-[]
-module Fantomas
-
-let format _ = Proc.exec "dotnet fantomas ."
-
-let check _ = Proc.exec "dotnet fantomas --check ."
diff --git a/Build/src/Program.fs b/Build/src/Program.fs
deleted file mode 100644
index 2778800..0000000
--- a/Build/src/Program.fs
+++ /dev/null
@@ -1,22 +0,0 @@
-module Program
-
-open Fake.Core
-
-Fake.initialize ()
-
-Target.create "clean" DotNet.clean
-Target.create "build" DotNet.build
-Target.create "test" DotNet.test
-Target.create "release" (DotNet.release "Damo.Io.Server")
-
-Target.create "format" Fantomas.format
-Target.create "lint" Fantomas.check
-
-"build" |> Target.mustRunAfter "clean"
-"test" |> Target.dependsOn [ "build" ]
-"release" |> Target.dependsOn [ "clean"; "lint"; "test"; "build" ]
-
-Deploy.loadTasks ()
-
-[]
-let main args = Fake.runWithDefault "release" args
diff --git a/Build/src/Support.fs b/Build/src/Support.fs
deleted file mode 100644
index 18d0596..0000000
--- a/Build/src/Support.fs
+++ /dev/null
@@ -1,56 +0,0 @@
-[]
-module Support
-
-open Fake.Core
-open Fake.Core.TargetOperators
-open Fake.IO
-open System.IO
-
-exception ProcessException
-
-[]
-type Proc private () =
- static member exec(cmd: string, ?pwd: string) =
- let (program: string, commandLine: string) =
- match Array.toList (cmd.Split " ") with
- | [ program ] -> program, ""
- | program :: args -> program, String.concat " " args
- | _ -> "", ""
-
- let exitCode: int =
- Process.shellExec
- { Program = program
- WorkingDir = Option.defaultValue "." pwd
- CommandLine = commandLine
- Args = [] }
-
- if exitCode <> 0 then raise ProcessException else ()
-
-[]
-module File =
- let write filePath content =
- Directory.GetParent(filePath).Create()
- File.writeString false filePath content
-
-[]
-module Fake =
- let initialize () =
- let ctx = Context.FakeExecutionContext.Create false "Program.fs" []
- Context.setExecutionContext (Context.RuntimeContext.Fake ctx)
-
- let runWithDefault defaultTarget args =
- try
- match args with
- | [| target |] -> Target.runOrDefault target
- | _ -> Target.runOrDefault defaultTarget
-
- 0
- with e ->
- printfn $"%A{e}"
- 1
-
-[]
-module Target =
- let dependsOn dependencies task = task <== dependencies
-
- let mustRunAfter afterTask beforeTask = beforeTask <=? afterTask |> ignore
diff --git a/Damo.Io.Blog/Damo.Io.Blog.fsproj b/Damo.Io.Blog/Damo.Io.Blog.fsproj
index 179ee16..aa07760 100644
--- a/Damo.Io.Blog/Damo.Io.Blog.fsproj
+++ b/Damo.Io.Blog/Damo.Io.Blog.fsproj
@@ -26,10 +26,14 @@
-
+
+
+
+
+
PreserveNewest
-
+
PreserveNewest
diff --git a/Damo.Io.Blog/deployment/Dockerfile b/Damo.Io.Blog/deployment/Dockerfile
new file mode 100644
index 0000000..000e258
--- /dev/null
+++ b/Damo.Io.Blog/deployment/Dockerfile
@@ -0,0 +1,15 @@
+FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+
+WORKDIR /workspace
+
+COPY . .
+
+RUN dotnet restore
+
+WORKDIR /workspace/Damo.Io.Blog
+
+RUN dotnet run
+
+FROM nginx
+
+COPY --from=build /workspace/Damo.Io.Blog/build/public /usr/share/nginx/html
diff --git a/Damo.Io.Blog/src/BlogGenerator/Build.fs b/Damo.Io.Blog/src/BlogGenerator/Build.fs
index d7b8e9b..628ecf7 100644
--- a/Damo.Io.Blog/src/BlogGenerator/Build.fs
+++ b/Damo.Io.Blog/src/BlogGenerator/Build.fs
@@ -79,9 +79,6 @@ module Build =
|> (fun xml -> xml.Save $"%s{publicPath}/rss.xml")
|> always posts
- let private generateHerokuConfig _ =
- """{"root": "public/"}""" |> File.writeString false $"%s{buildPath}/static.json"
-
let run _ =
cleanupBuildDir ()
copyResources ()
@@ -91,4 +88,4 @@ module Build =
|> generateTagPages
|> generateIndex
|> generateRssFeed
- |> generateHerokuConfig
+ |> ignore
diff --git a/Damo.Io.Server/Damo.Io.Server.fsproj b/Damo.Io.Server/Damo.Io.Server.fsproj
index d8d59fe..8ccd410 100644
--- a/Damo.Io.Server/Damo.Io.Server.fsproj
+++ b/Damo.Io.Server/Damo.Io.Server.fsproj
@@ -32,6 +32,10 @@
+
+
+
+
PreserveNewest
diff --git a/Damo.Io.Server/deployment/Dockerfile b/Damo.Io.Server/deployment/Dockerfile
new file mode 100644
index 0000000..b792e0c
--- /dev/null
+++ b/Damo.Io.Server/deployment/Dockerfile
@@ -0,0 +1,19 @@
+FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+
+WORKDIR /workspace
+
+COPY . .
+
+RUN dotnet restore
+
+WORKDIR /workspace/Damo.Io.Server
+
+RUN dotnet publish -c Release -o out
+
+FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
+
+WORKDIR /app
+
+COPY --from=build /workspace/Damo.Io.Server/out .
+
+CMD ["dotnet", "Damo.Io.Server.dll"]
diff --git a/Makefile b/Makefile
index 6c8f495..0cf1f50 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,24 @@
-.PHONY: restore build lint format
+.PHONY: restore clean check format damo.io.server.container damo.io.blog.container dev
restore:
dotnet tool restore
dotnet restore
-build:
- dotnet run --project Build
+clean:
+ dotnet clean
-lint:
- dotnet run --project Build lint
+check:
+ dotnet fantomas --check .
+ dotnet test
format:
- dotnet run --project Build format
+ dotnet fantomas .
+
+damo.io.server.container:
+ docker build -t damo.io.server -f Damo.Io.Server/deployment/Dockerfile .
+
+damo.io.blog.container:
+ docker build -t damo.io.blog -f Damo.Io.Blog/deployment/Dockerfile .
dev:
dotnet watch run --project Damo.Io.Server
diff --git a/SoManyFeeds.sln b/SoManyFeeds.sln
index bf12a31..28dc4c3 100644
--- a/SoManyFeeds.sln
+++ b/SoManyFeeds.sln
@@ -1,10 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-#
+#
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Damo.Io.Server", "Damo.Io.Server\Damo.Io.Server.fsproj", "{A7157346-F377-4B8A-8CF2-1DB962115171}"
EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Build", "Build\Build.fsproj", "{48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}"
-EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FeedsProcessing", "FeedsProcessing\FeedsProcessing.fsproj", "{B4BC8FCB-9682-43BA-8676-680224209DA5}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FeedsProcessing.Tests", "FeedsProcessing.Tests\FeedsProcessing.Tests.fsproj", "{55BB409D-D281-4C3A-A108-5D4517F2E894}"
@@ -47,18 +45,6 @@ Global
{55BB409D-D281-4C3A-A108-5D4517F2E894}.Release|x64.Build.0 = Release|x64
{55BB409D-D281-4C3A-A108-5D4517F2E894}.Release|x86.ActiveCfg = Release|x86
{55BB409D-D281-4C3A-A108-5D4517F2E894}.Release|x86.Build.0 = Release|x86
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Debug|x64.ActiveCfg = Debug|x64
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Debug|x64.Build.0 = Debug|x64
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Debug|x86.ActiveCfg = Debug|x86
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Debug|x86.Build.0 = Debug|x86
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Release|Any CPU.Build.0 = Release|Any CPU
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Release|x64.ActiveCfg = Release|x64
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Release|x64.Build.0 = Release|x64
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Release|x86.ActiveCfg = Release|x86
- {48AB536C-C4D7-4A79-88CD-92DB6CCB3A95}.Release|x86.Build.0 = Release|x86
{E437D872-2D9A-4752-9A38-B52078E6D3A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E437D872-2D9A-4752-9A38-B52078E6D3A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E437D872-2D9A-4752-9A38-B52078E6D3A5}.Debug|x64.ActiveCfg = Debug|Any CPU