diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..cf69769bd
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+**/bin/
+**/obj/
+**/out/
+**/TestResults/
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 12d0ea04a..f76e58e33 100644
--- a/.gitignore
+++ b/.gitignore
@@ -250,3 +250,5 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
+
+**/out
\ No newline at end of file
diff --git a/DOCKERFILE b/DOCKERFILE
deleted file mode 100644
index 6af9affcd..000000000
--- a/DOCKERFILE
+++ /dev/null
@@ -1,19 +0,0 @@
-# Build image
-FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS builder
-WORKDIR /app
-
-# Copy files
-COPY . ./
-
-RUN dotnet restore ./EventSourcing.NetCore.sln
-RUN dotnet build ./EventSourcing.NetCore.sln
-
-WORKDIR /app/Sample/BankAccounts/EventSourcing.Sample.Web
-RUN dotnet publish -c Debug -o out
-
-# Build runtime image
-FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
-WORKDIR /app
-COPY --from=builder /app/Sample/BankAccounts/EventSourcing.Sample.Web/out .
-ENV ASPNETCORE_URLS="http://*:5000"
-ENTRYPOINT ["dotnet", "EventSourcing.Sample.Web.dll"]
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..83a2c2c71
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,60 @@
+########################################
+# First stage of multistage build
+########################################
+# Use Build image with label `builder
+########################################
+FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS builder
+
+# Setup working directory for project
+WORKDIR /app
+
+COPY ./Core/Core.csproj ./Core/
+COPY ./Core.Marten/Core.Marten.csproj ./Core.Marten/
+COPY ./Sample/Tickets/Tickets/Tickets.csproj ./Sample/Tickets/Tickets/
+COPY ./Sample/Tickets/Tickets.Api/ ./Sample/Tickets/Tickets.Api/
+
+# Restore nuget packages
+RUN dotnet restore ./Sample/Tickets/Tickets.Api/Tickets.Api.csproj
+
+# Copy project files
+COPY ./Core ./Core
+COPY ./Core.Marten ./Core.Marten
+COPY ./Sample/Tickets/Tickets ./Sample/Tickets/Tickets
+COPY ./Sample/Tickets/Tickets.Api ./Sample/Tickets/Tickets.Api
+
+# Build project with Release configuration
+# and no restore, as we did it already
+RUN dotnet build -c Release --no-restore ./Sample/Tickets/Tickets.Api/Tickets.Api.csproj
+
+## Test project with Release configuration
+## and no build, as we did it already
+#RUN dotnet test -c Release --no-build ./Sample/Tickets/Tickets.Api/Tickets.Api.csproj
+
+
+# Publish project to output folder
+# and no build, as we did it already
+WORKDIR /app/Sample/Tickets/Tickets.Api
+RUN ls
+RUN dotnet publish -c Release --no-build -o out
+
+########################################
+# Second stage of multistage build
+########################################
+# Use other build image as the final one
+# that won't have source codes
+########################################
+FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine
+
+# Setup working directory for project
+WORKDIR /app
+
+# Copy published in previous stage binaries
+# from the `builder` image
+COPY --from=builder /app/Sample/Tickets/Tickets.Api/out .
+
+# Set URL that App will be exposed
+ENV ASPNETCORE_URLS="http://*:5000"
+
+# sets entry point command to automatically
+# run application on `docker run`
+ENTRYPOINT ["dotnet", "Tickets.Api.dll"]
diff --git a/EventSourcing.NetCore.sln b/EventSourcing.NetCore.sln
index d6a1abf82..14ca81fa9 100644
--- a/EventSourcing.NetCore.sln
+++ b/EventSourcing.NetCore.sln
@@ -503,4 +503,11 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A5F55604-2FF3-43B7-B657-4F18E6E95D3B}
EndGlobalSection
+ GlobalSection(RiderSharedRunConfigurations) = postSolution
+ File = Workshops\PracticalEventSourcing\Carts.run.xml
+ File = Workshops\PracticalEventSourcing\Orders.run.xml
+ File = Workshops\PracticalEventSourcing\Payments.run.xml
+ File = Workshops\PracticalEventSourcing\PracticalEventSourcing.run.xml
+ File = Workshops\PracticalEventSourcing\Shipments.run.xml
+ EndGlobalSection
EndGlobal
diff --git a/README.md b/README.md
index e27838eea..8ae1733c1 100644
--- a/README.md
+++ b/README.md
@@ -37,17 +37,19 @@ Feel free to [create an issue](https://github.com/oskardudycz/EventSourcing.NetC
## 2. Prerequisites
-For running the Event Store examples you need to have Postgres DB. You can get it by:
+For running the Event Store examples you need to have:
+1. .NET 5 installed - https://dotnet.microsoft.com/download/dotnet/5.0
+2. Postgres DB. You can get it by:
- Installing [Docker](https://store.docker.com/search?type=edition&offering=community), going to the `docker` folder and running:
```
docker-compose up
```
+- Installing a most recent version of the Postgres DB (eg. from ).
-**More information about using .NET Core, WebApi and Docker you can find in my other tutorial:** [.Net Core With Docker](https://github.com/oskardudycz/NetCoreWithDocker)
+**More information about using .NET Core, WebApi and Docker you can find in my other tutorials:** [WebApi with .NET](https://github.com/oskardudycz/WebApiWith.NETCore)
-- Installing a most recent version of the Postgres DB (eg. from ).
Watch "Practical Event Sourcing with Marten":
@@ -302,4 +304,4 @@ Support this project with your organization. Your logo will show up here with a
-**EventSourcing.NetCore** is Copyright © 2017-2020 [Oskar Dudycz](http://oskar-dudycz.pl) and other contributors under the [MIT license](LICENSE).
+**EventSourcing.NetCore** is Copyright © 2017-2021 [Oskar Dudycz](http://oskar-dudycz.pl) and other contributors under the [MIT license](LICENSE).
diff --git a/Sample/Tickets/Tickets.sln b/Sample/Tickets/Tickets.sln
index 1306bd31f..ed15b48e4 100644
--- a/Sample/Tickets/Tickets.sln
+++ b/Sample/Tickets/Tickets.sln
@@ -1,9 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{5985A39C-B4DE-438B-9AF9-BDCA9B15876E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Testing", "Core.Testing\Core.Testing.csproj", "{57EA5769-4B22-45C9-A525-6256B95A17C6}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tickets", "Tickets\Tickets.csproj", "{F48D6AE8-49A5-4890-BA18-C0AEBD9A411C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tickets.Api", "Tickets.Api\Tickets.Api.csproj", "{B550D4DB-33D5-4560-AE32-0773BB7BAAF8}"
@@ -12,20 +8,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tickets.Api.Tests", "Ticket
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tickets.Tests", "Tickets.Tests\Tickets.Tests.csproj", "{3349648E-E8EB-49C6-BDA0-D8E675F36B88}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "..\..\Core\Core.csproj", "{868A877F-2073-4AFD-8573-7FC16B4E82C5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Marten", "..\..\Core.Marten\Core.Marten.csproj", "{7CB6C83C-75AA-4639-BC46-1BF99D26512C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Testing", "..\..\Core.Testing\Core.Testing.csproj", "{87D49BAA-91B6-4209-868B-B5C8C9E1C8EF}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {5985A39C-B4DE-438B-9AF9-BDCA9B15876E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5985A39C-B4DE-438B-9AF9-BDCA9B15876E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5985A39C-B4DE-438B-9AF9-BDCA9B15876E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5985A39C-B4DE-438B-9AF9-BDCA9B15876E}.Release|Any CPU.Build.0 = Release|Any CPU
- {57EA5769-4B22-45C9-A525-6256B95A17C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {57EA5769-4B22-45C9-A525-6256B95A17C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {57EA5769-4B22-45C9-A525-6256B95A17C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {57EA5769-4B22-45C9-A525-6256B95A17C6}.Release|Any CPU.Build.0 = Release|Any CPU
{F48D6AE8-49A5-4890-BA18-C0AEBD9A411C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F48D6AE8-49A5-4890-BA18-C0AEBD9A411C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F48D6AE8-49A5-4890-BA18-C0AEBD9A411C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -42,5 +36,17 @@ Global
{3349648E-E8EB-49C6-BDA0-D8E675F36B88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3349648E-E8EB-49C6-BDA0-D8E675F36B88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3349648E-E8EB-49C6-BDA0-D8E675F36B88}.Release|Any CPU.Build.0 = Release|Any CPU
+ {868A877F-2073-4AFD-8573-7FC16B4E82C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {868A877F-2073-4AFD-8573-7FC16B4E82C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {868A877F-2073-4AFD-8573-7FC16B4E82C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {868A877F-2073-4AFD-8573-7FC16B4E82C5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7CB6C83C-75AA-4639-BC46-1BF99D26512C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7CB6C83C-75AA-4639-BC46-1BF99D26512C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7CB6C83C-75AA-4639-BC46-1BF99D26512C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7CB6C83C-75AA-4639-BC46-1BF99D26512C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {87D49BAA-91B6-4209-868B-B5C8C9E1C8EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {87D49BAA-91B6-4209-868B-B5C8C9E1C8EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {87D49BAA-91B6-4209-868B-B5C8C9E1C8EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {87D49BAA-91B6-4209-868B-B5C8C9E1C8EF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/Workshops/BuildYourOwnEventStore/Readme.md b/Workshops/BuildYourOwnEventStore/Readme.md
index 426094849..a4e366a89 100644
--- a/Workshops/BuildYourOwnEventStore/Readme.md
+++ b/Workshops/BuildYourOwnEventStore/Readme.md
@@ -3,7 +3,7 @@
## Prerequisities
1. Install git - https://git-scm.com/downloads.
-2. Install .NET Core 3.1 - https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.402-windows-x64-installer.
+2. Install .NET 5 - https://dotnet.microsoft.com/download/dotnet/5.0.
3. Install Visual Studio 2019, Rider or VSCode.
4. Install docker - https://docs.docker.com/docker-for-windows/install/.
5. Make sure that you have ~10GB disk space.
diff --git a/docker-compose.yml b/docker-compose.yml
index 871ab45f5..6188d4c77 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -5,7 +5,7 @@ services:
container_name: postgres
hostname: postgres
environment:
- - postgres/variables.env
+ POSTGRES_PASSWORD: Password12!
ports:
- "5432:5432"
networks:
@@ -15,13 +15,25 @@ services:
interval: 10s
timeout: 5s
retries: 5
+
+ pgadmin:
+ image: dpage/pgadmin4
+ container_name: pgadmin
+ environment:
+ PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@pgadmin.org}
+ PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
+ ports:
+ - "${PGADMIN_PORT:-5050}:80"
+ networks:
+ - es_network
+
backend:
build:
- dockerfile: DOCKERFILE
+ dockerfile: Dockerfile
context: .
container_name: event_sourcing_sample
ports:
- - "5000:5000"
+ - "5555:5000"
depends_on:
postgres:
condition: service_healthy