feat: add architecture style to project

This commit is contained in:
Meysam Hadeli 2025-03-15 01:39:43 +03:30
parent 76551a21f2
commit ccce0faef1
525 changed files with 670 additions and 712 deletions

View File

@ -20,13 +20,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build and Test Flight
- name: Build and Test Flight Microservice
uses: ./.github/actions/build-test
if: success()
id: build-test-flight-step
with:
project-path: 'src/Services/Flight/src/Flight.Api'
tests-path: 'src/Services/Flight/tests/'
project-path: '3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api'
tests-path: '3-Microservices-Architecture-Style/src/Services/Flight/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@ -35,13 +35,13 @@ jobs:
service-name: 'Flight'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Test Identity
- name: Build and Test Identity Microservice
uses: ./.github/actions/build-test
if: success()
id: build-test-identity-step
with:
project-path: 'src/Services/Identity/src/Identity.Api'
tests-path: 'src/Services/Identity/tests/'
project-path: '3-Microservices-Architecture-Style/src/Services/Identity/src/Identity.Api'
tests-path: '3-Microservices-Architecture-Style/src/Services/Identity/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@ -50,13 +50,13 @@ jobs:
service-name: 'Identity'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Test Passenger
- name: Build and Test Passenger Microservice
uses: ./.github/actions/build-test
if: success()
id: build-test-passenger-step
with:
project-path: 'src/Services/Passenger/src/Passenger.Api'
tests-path: 'src/Services/Passenger/tests/'
project-path: '3-Microservices-Architecture-Style/src/Services/Passenger/src/Passenger.Api'
tests-path: '3-Microservices-Architecture-Style/src/Services/Passenger/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@ -65,13 +65,13 @@ jobs:
service-name: 'Passenger'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Test Booking
- name: Build and Test Booking Microservice
uses: ./.github/actions/build-test
if: success()
id: build-test-booking-step
with:
project-path: 'src/Services/Booking/src/Booking.Api'
tests-path: 'src/Services/Booking/tests/'
project-path: '3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api'
tests-path: '3-Microservices-Architecture-Style/src/Services/Booking/tests/'
# wildcard search for files with the ".cobertura.xml" extension in all subdirectories of the current directory
# https://www.jamescroft.co.uk/combining-multiple-code-coverage-results-in-azure-devops/
# https://stackoverflow.com/questions/53255065/dotnet-unit-test-with-coverlet-how-to-get-coverage-for-entire-solution-and-not
@ -91,42 +91,42 @@ jobs:
run:
echo "Release version is:" ${{ steps.last_release.outputs.tag_name }}
- name: Build and Publish Identity to Docker
- name: Build and Publish Identity Microservice to Docker
if: ${{ github.ref == 'refs/heads/main' && success() }}
uses: ./.github/actions/docker-build-publish
with:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
dockerfile-path: 'src/Services/Identity/Dockerfile'
dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Identity/Dockerfile'
image-name: 'booking-microservices-identity'
- name: Build and Publish Flight to Docker
- name: Build and Publish Flight Microservice to Docker
if: ${{ github.ref == 'refs/heads/main' && success() }}
uses: ./.github/actions/docker-build-publish
with:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
dockerfile-path: 'src/Services/Flight/Dockerfile'
dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Flight/Dockerfile'
image-name: 'booking-microservices-flight'
- name: Build and Publish Passenger to Docker
- name: Build and Publish Passenger Microservice to Docker
if: ${{ github.ref == 'refs/heads/main' && success() }}
uses: ./.github/actions/docker-build-publish
with:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
dockerfile-path: 'src/Services/Passenger/Dockerfile'
dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Passenger/Dockerfile'
image-name: 'booking-microservices-passenger'
- name: Build and Publish Booking to Docker
- name: Build and Publish Booking Microservice to Docker
if: ${{ github.ref == 'refs/heads/main' && success() }}
uses: ./.github/actions/docker-build-publish
with:
tag-name: ${{ steps.last_release.outputs.tag_name }}
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
dockerfile-path: 'src/Services/Booking/Dockerfile'
dockerfile-path: '3-Microservices-Architecture-Style/src/Services/Booking/Dockerfile'
image-name: 'booking-microservices-booking'

View File

View File

@ -0,0 +1,45 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS builder
WORKDIR /
COPY ./.editorconfig ./
COPY ./global.json ./
COPY ./Directory.Build.props ./
# Setup working directory for the project
COPY ./BuildingBlocks/BuildingBlocks.csproj ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/ApiGateway/src/ApiGateway.csproj ./3-Microservices-Architecture-Style/src/ApiGateway/src/
# Restore nuget packages
RUN dotnet restore ./3-Microservices-Architecture-Style/src/ApiGateway/src/ApiGateway.csproj
# Copy project files
COPY ./BuildingBlocks ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/ApiGateway/src ./3-Microservices-Architecture-Style/src/ApiGateway/src/
# Build project with Release configuration
# and no restore, as we did it already
RUN ls
RUN dotnet build -c Release --no-restore ./3-Microservices-Architecture-Style/src/ApiGateway/src/ApiGateway.csproj
WORKDIR /3-Microservices-Architecture-Style/src/ApiGateway/src
# Publish project to output folder
# and no build, as we did it already
RUN dotnet publish -c Release --no-build -o out
FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Setup working directory for the project
WORKDIR /
COPY --from=builder /3-Microservices-Architecture-Style/src/ApiGateway/src/out .
ENV ASPNETCORE_URLS https://*:443, http://*:80
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "ApiGateway.dll"]

View File

@ -6,26 +6,26 @@ COPY ./global.json ./
COPY ./Directory.Build.props ./
# Setup working directory for the project
COPY ./src/BuildingBlocks/BuildingBlocks.csproj ./BuildingBlocks/
COPY ./src/ApiGateway/src/ApiGateway.csproj ./ApiGateway/src/
COPY ./BuildingBlocks/BuildingBlocks.csproj ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/ApiGateway/src/ApiGateway.csproj ./3-Microservices-Architecture-Style/src/ApiGateway/src/
# Restore nuget packages
RUN --mount=type=cache,id=gateway_nuget,target=/root/.nuget/packages \
dotnet restore ./ApiGateway/src/ApiGateway.csproj
dotnet restore ./3-Microservices-Architecture-Style/src/ApiGateway/src/ApiGateway.csproj
# Copy project files
COPY ./src/BuildingBlocks ./BuildingBlocks/
COPY ./src/ApiGateway/src ./ApiGateway/src/
COPY ./BuildingBlocks ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/ApiGateway/src ./3-Microservices-Architecture-Style/src/ApiGateway/src/
# Build project with Release configuration
# and no restore, as we did it already
RUN ls
RUN --mount=type=cache,id=gateway_nuget,target=/root/.nuget/packages \
dotnet build -c Release --no-restore ./ApiGateway/src/ApiGateway.csproj
dotnet build -c Release --no-restore ./3-Microservices-Architecture-Style/src/ApiGateway/src/ApiGateway.csproj
WORKDIR /ApiGateway/src
WORKDIR /3-Microservices-Architecture-Style/src/ApiGateway/src
# Publish project to output folder
# and no build, as we did it already
@ -36,7 +36,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Setup working directory for the project
WORKDIR /
COPY --from=builder /src/ApiGateway/src/out .
COPY --from=builder /3-Microservices-Architecture-Style/src/ApiGateway/src/out .
ENV ASPNETCORE_URLS https://*:443, http://*:80
ENV ASPNETCORE_ENVIRONMENT docker

View File

@ -0,0 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<ProjectReference Include="..\..\..\..\BuildingBlocks\BuildingBlocks.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,47 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS builder
WORKDIR /
COPY ./.editorconfig ./
COPY ./global.json ./
COPY ./Directory.Build.props ./
# Setup working directory for the project
COPY ./BuildingBlocks/BuildingBlocks.csproj ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/Booking.csproj ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/Booking.Api.csproj ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/
# Restore nuget packages
RUN dotnet restore ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/Booking.Api.csproj
# Copy project files
COPY ./BuildingBlocks ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/ ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/ ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/
# Build project with Release configuration
# and no restore, as we did it already
RUN ls
RUN dotnet build -c Release --no-restore ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/Booking.Api.csproj
WORKDIR /3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api
# Publish project to output folder
# and no build, as we did it already
RUN dotnet publish -c Release --no-build -o out
FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Setup working directory for the project
WORKDIR /
COPY --from=builder /3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/out .
ENV ASPNETCORE_URLS https://*:443, http://*:80
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "Booking.Api.dll"]

View File

@ -0,0 +1,50 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS builder
WORKDIR /
COPY ./.editorconfig ./
COPY ./global.json ./
COPY ./Directory.Build.props ./
# Setup working directory for the project
COPY ./BuildingBlocks/BuildingBlocks.csproj ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/Booking.csproj ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/Booking.Api.csproj ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/
# Restore nuget packages
RUN --mount=type=cache,id=booking_nuget,target=/root/.nuget/packages \
dotnet restore ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/Booking.Api.csproj
# Copy project files
COPY ./BuildingBlocks ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/ ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking/
COPY ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/ ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/
# Build project with Release configuration
# and no restore, as we did it already
RUN ls
RUN --mount=type=cache,id=booking_nuget,target=/root/.nuget/packages\
dotnet build -c Release --no-restore ./3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/Booking.Api.csproj
WORKDIR /3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api
# Publish project to output folder
# and no build, as we did it already
RUN --mount=type=cache,id=booking_nuget,target=/root/.nuget/packages\
dotnet publish -c Release --no-build -o out
FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Setup working directory for the project
WORKDIR /
COPY --from=builder /3-Microservices-Architecture-Style/src/Services/Booking/src/Booking.Api/out .
ENV ASPNETCORE_URLS https://*:443, http://*:80
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "Booking.Api.dll"]

View File

@ -1,7 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<ProjectReference Include="..\Booking\Booking.csproj" />
</ItemGroup>
</Project>

View File

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\..\..\BuildingBlocks\BuildingBlocks.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.Tools" Version="2.68.1">
<PrivateAssets>all</PrivateAssets>
@ -23,4 +19,8 @@
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\BuildingBlocks\BuildingBlocks.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,48 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS builder
WORKDIR /
COPY ./.editorconfig ./
COPY ./global.json ./
COPY ./Directory.Build.props ./
# Setup working directory for the project
COPY ./BuildingBlocks/BuildingBlocks.csproj ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/Flight.csproj ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/
COPY ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/Flight.Api.csproj ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/
# Restore nuget packages
RUN dotnet restore ./Services/Flight/src/Flight.Api/Flight.Api.csproj
# Copy project files
COPY ./BuildingBlocks ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/ ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/
COPY ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/ ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/
# Build project with Release configuration
# and no restore, as we did it already
RUN ls
RUN dotnet build -c Release --no-restore ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/Flight.Api.csproj
WORKDIR /3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api
# Publish project to output folder
# and no build, as we did it already
RUN dotnet publish -c Release --no-build -o out
FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Setup working directory for the project
WORKDIR /
COPY --from=builder /3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/out .
ENV ASPNETCORE_URLS https://*:443, http://*:80
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "Flight.Api.dll"]

View File

@ -0,0 +1,51 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS builder
WORKDIR /
COPY ./.editorconfig ./
COPY ./global.json ./
COPY ./Directory.Build.props ./
# Setup working directory for the project
COPY ./BuildingBlocks/BuildingBlocks.csproj ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/Flight.csproj ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/
COPY ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/Flight.Api.csproj ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/
# Restore nuget packages
RUN --mount=type=cache,id=flight_nuget,target=/root/.nuget/packages \
dotnet restore ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/Flight.Api.csproj
# Copy project files
COPY ./BuildingBlocks ./BuildingBlocks/
COPY ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/ ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight/
COPY .3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/ ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/
# Build project with Release configuration
# and no restore, as we did it already
RUN ls
RUN --mount=type=cache,id=flight_nuget,target=/root/.nuget/packages \
dotnet build -c Release --no-restore ./3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/Flight.Api.csproj
WORKDIR /3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api
# Publish project to output folder
# and no build, as we did it already
RUN --mount=type=cache,id=flight_nuget,target=/root/.nuget/packages \
dotnet publish -c Release --no-build -o out
FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Setup working directory for the project
WORKDIR /
COPY --from=builder /3-Microservices-Architecture-Style/src/Services/Flight/src/Flight.Api/out .
ENV ASPNETCORE_URLS https://*:443, http://*:80
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "Flight.Api.dll"]

Some files were not shown because too many files have changed in this diff Show More