Skip to content

Commit 81b879f

Browse files
committed
🐳feat: introduce fully functional Docker setup with database & migrations
• Docker is now fully adopted as part of the project infrastructure. - Moved docker-compose.yml to the project root and updated it to version 3.8 with dedicated services for the API and the database. - Updated Dockerfile to build and run EventFlow.Presentation, changed the exposed port to 8079, and improved .dockerignore. - Added automatic EF Core migrations on application startup to ensure the database schema is created and updated automatically. This marks the first complete and working Docker integration, including database support, rather than a partial or experimental setup.
1 parent 83b0fbd commit 81b879f

11 files changed

Lines changed: 1317 additions & 27 deletions

ā€Ž.dockerignoreā€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ README.md
2727
!.git/HEAD
2828
!.git/config
2929
!.git/packed-refs
30-
!.git/refs/heads/**
30+
!.git/refs/heads/**
31+
**/EventFlow.WebApp
32+
**/bin
33+
**/obj

ā€ŽDockerfileā€Ž

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
# Dockerfile
21
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
32
WORKDIR /app
4-
EXPOSE 8080
3+
EXPOSE 8079
54

65
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
76
WORKDIR /src
8-
COPY ["EventFlow-API.csproj", "."]
9-
RUN dotnet restore "./EventFlow-API.csproj"
7+
8+
COPY ["EventFlow.Presentation/EventFlow.Presentation.csproj", "EventFlow.Presentation/"]
9+
COPY ["EventFlow.Application/EventFlow.Application.csproj", "EventFlow.Application/"]
10+
COPY ["EventFlow.Core/EventFlow.Core.csproj", "EventFlow.Core/"]
11+
COPY ["EventFlow.Infrastructure/EventFlow.Infrastructure.csproj", "EventFlow.Infrastructure/"]
12+
13+
RUN dotnet restore "EventFlow.Presentation/EventFlow.Presentation.csproj"
14+
1015
COPY . .
11-
RUN dotnet build "./EventFlow-API.csproj" -c Release -o /app/build
16+
WORKDIR "/src/EventFlow.Presentation"
17+
18+
RUN dotnet build "EventFlow.Presentation.csproj" -c Release -o /app/build
1219

1320
FROM build AS publish
14-
RUN dotnet publish "./EventFlow-API.csproj" -c Release -o /app/publish /p:UseAppHost=false
21+
RUN dotnet publish "EventFlow.Presentation.csproj" -c Release -o /app/publish /p:UseAppHost=false
1522

1623
FROM base AS final
1724
WORKDIR /app
1825
COPY --from=publish /app/publish .
19-
ENTRYPOINT ["dotnet", "EventFlow-API.dll"]
26+
USER app
27+
28+
ENTRYPOINT ["dotnet", "EventFlow.Presentation.dll"]

ā€ŽEventFlow.Infrastructure/EventFlow.Infrastructure.csprojā€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
<ProjectReference Include="..\EventFlow.Core\EventFlow.Core.csproj" />
2727
</ItemGroup>
2828

29+
<ItemGroup>
30+
<Folder Include="Migrations\" />
31+
</ItemGroup>
32+
2933
</Project>

ā€ŽEventFlow.Infrastructure/Migrations/20260115203543_InitialCreate.Designer.csā€Ž

Lines changed: 292 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Ā (0)