mirror of
https://github.com/ivanpaulovich/clean-architecture-manga.git
synced 2025-01-07 03:17:10 +08:00
parent
61d1aacc23
commit
d381473499
1
.gitignore
vendored
1
.gitignore
vendored
@ -286,3 +286,4 @@ __pycache__/
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
.DS_Store
|
12
Dockerfile
12
Dockerfile
@ -1,12 +0,0 @@
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build-env
|
||||
WORKDIR /app
|
||||
|
||||
# Copy everything else and build
|
||||
COPY . ./
|
||||
RUN dotnet publish -c Release -o out
|
||||
|
||||
# Build runtime image
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/out .
|
||||
CMD export ASPNETCORE_URLS=http://*:$PORT && dotnet WebApi.dll
|
16
README.md
16
README.md
@ -1,22 +1,14 @@
|
||||
# Manga: The Clean Architecture Sample Implementation with .NET Core :cyclone:
|
||||
[![All Contributors](https://img.shields.io/badge/all_contributors-15-orange.svg?style=flat-square)](#contributors)
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/0i6s33kw3y87tkb2?svg=true)](https://ci.appveyor.com/project/ivanpaulovich/clean-architecture-manga)<a href="https://www.nuget.org/packages/Paulovich.Caju/" rel="Paulovich.Caju"> ![NuGet](https://buildstats.info/nuget/paulovich.caju)</a> [![Build Status](https://travis-ci.org/ivanpaulovich/dotnet-new-caju.svg?branch=master)](https://travis-ci.org/ivanpaulovich/dotnet-new-caju) [![Build Status](https://dev.azure.com/ivanpaulovich/clean-architecture-manga/_apis/build/status/ivanpaulovich.clean-architecture-manga?branchName=master)](https://dev.azure.com/ivanpaulovich/clean-architecture-manga/_build/latest?definitionId=20&branchName=master)
|
||||
[![All Contributors](https://img.shields.io/badge/all_contributors-15-orange.svg?style=flat-square)](#contributors) [![Build Status](https://dev.azure.com/ivanpaulovich/clean-architecture-manga/_apis/build/status/ivanpaulovich.clean-architecture-manga?branchName=master)](https://dev.azure.com/ivanpaulovich/clean-architecture-manga/_build/latest?definitionId=20&branchName=master)
|
||||
|
||||
Sample implementation of the **Clean Architecture Principles with .NET Core**. Use cases as central organizing structure, decoupled from frameworks and technology details. Built with small components that are developed and tested in isolation.
|
||||
|
||||
# Usage
|
||||
|
||||
```sh
|
||||
dotnet new -i Paulovich.Caju::0.7.3
|
||||
dotnet new manga -n "MyGreatApi"
|
||||
```
|
||||
|
||||
**ProTip #1:** To get the Clean Architecture updates hit the `WATCH` button :eyes:.
|
||||
|
||||
**Manga** is a virtual Wallet application in which a customer can register an account then manage the balance with `Deposits`, `Withdraws` and `Transfers`.
|
||||
|
||||
The Manga's demo is hosted on `Heroku` servers and the `Swagger UI` client is available at [https://clean-architecture-herokuapp.com/swagger/](https://clean-architecture-herokuapp.com/swagger/). It is just beautiful!
|
||||
[![Swagger Demo](https://raw.githubusercontent.com/ivanpaulovich/clean-architecture-manga/master/docs/clean-architecture-manga-swagger.png)](https://clean-architecture-herokuapp.com/swagger/index.html)
|
||||
The Manga's demo is hosted on `Azure` servers and the `Swagger UI` client is available at [https://clean-architecture-manga.azurewebsites.net/swagger/index.html](https://clean-architecture-manga.azurewebsites.net/swagger/). It is just beautiful!
|
||||
[![Swagger Demo](https://raw.githubusercontent.com/ivanpaulovich/clean-architecture-manga/master/docs/clean-architecture-manga-swagger.png)](https://clean-architecture-manga.azurewebsites.net/swagger/index.html)
|
||||
|
||||
|
||||
<p align="center">
|
||||
@ -1326,7 +1318,7 @@ CMD export ASPNETCORE_URLS=http://*:$PORT && dotnet WebApi.dll
|
||||
To spin up a SQL Server in a docker container using the connection string `Server=localhost;User Id=sa;Password=<YourNewStrong!Passw0rd>;` run the following command:
|
||||
|
||||
```sh
|
||||
./src/scripts/sql-docker-up.sh
|
||||
./sql-docker-up.sh
|
||||
```
|
||||
|
||||
## Related Content and Projects
|
||||
|
50
appveyor.yml
50
appveyor.yml
@ -1,50 +0,0 @@
|
||||
version: '1.0.{build}'
|
||||
image:
|
||||
- Ubuntu
|
||||
environment:
|
||||
DOCKER_USER:
|
||||
secure: YnlezJhfKFUWo+E5/WCikQ==
|
||||
DOCKER_PASS:
|
||||
secure: iwibHSi3B80XJ3KjT1sAS1c66AsaOP3UFyUKKWrL1jo=
|
||||
HEROKU_USERNAME:
|
||||
secure: CUWu9AI7dgCvD7XMGYEDtb7XQlvkcOSuxpdaKdzOu/M=
|
||||
HEROKU_API_KEY:
|
||||
secure: XEo5yF9x7hReDhlb66Aj6xnk2HOFboVzNW6BLR1+shV7MP1DhRl8J+hHg8Do7OKl
|
||||
HEROKU_APP_NAME:
|
||||
secure: tKa7ydQJbbA+uovQNa5sBs9OcRWsCj71r4l9wvDG7/I=
|
||||
services:
|
||||
- docker
|
||||
dotnet_csproj:
|
||||
patch: true
|
||||
file: '**\*.csproj'
|
||||
version: '{version}'
|
||||
install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install apt-transport-https
|
||||
- sudo apt-get install dotnet-sdk-3.0 -y
|
||||
- dotnet tool install --global dotnet-ef --version 3.0.0
|
||||
before_build:
|
||||
- dotnet --version
|
||||
build_script:
|
||||
- docker pull mcr.microsoft.com/mssql/server:2017-latest || true
|
||||
- docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2017-latest || true
|
||||
- sleep 10
|
||||
- docker exec -i sql1 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '<YourStrong!Passw0rd>' -Q 'ALTER LOGIN SA WITH PASSWORD="<YourNewStrong!Passw0rd>"' || true
|
||||
- dotnet ef database update --project src/Infrastructure --startup-project src/WebApi
|
||||
- dotnet build
|
||||
- pushd src/WebApi/
|
||||
- dotnet pack --configuration Release
|
||||
- popd
|
||||
test_script:
|
||||
- dotnet test test/UnitTests/UnitTests.csproj
|
||||
- dotnet test test/IntegrationTests/IntegrationTests.csproj
|
||||
- dotnet test test/AcceptanceTests/AcceptanceTests.csproj
|
||||
deploy_script:
|
||||
- docker build -t ivanpaulovich/clean-architecture-manga:github .
|
||||
- docker login -u="$DOCKER_USER" -p="$DOCKER_PASS"
|
||||
- docker push ivanpaulovich/clean-architecture-manga:github
|
||||
- docker login --username=$HEROKU_USERNAME --password=$HEROKU_API_KEY registry.heroku.com
|
||||
- docker tag ivanpaulovich/clean-architecture-manga:github registry.heroku.com/$HEROKU_APP_NAME/web
|
||||
- docker push registry.heroku.com/$HEROKU_APP_NAME/web
|
||||
- curl https://cli-assets.heroku.com/install.sh | sh
|
||||
- heroku container:release web -a $HEROKU_APP_NAME
|
@ -24,15 +24,4 @@ steps:
|
||||
inputs:
|
||||
command: test
|
||||
projects: '**/*Tests/*.csproj'
|
||||
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'dotnet publish $(buildConfiguration)'
|
||||
inputs:
|
||||
command: publish
|
||||
publishWebProjects: True
|
||||
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
|
||||
zipAfterPublish: True
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'publish artifacts'
|
||||
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
|
@ -4,7 +4,7 @@ services:
|
||||
image: ivanpaulovich/clean-architecture-manga
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: src/WebApi/Dockerfile
|
||||
ports:
|
||||
- 5500:80
|
||||
environment:
|
||||
|
BIN
src/.DS_Store
vendored
BIN
src/.DS_Store
vendored
Binary file not shown.
16
src/WebApi/Dockerfile
Normal file
16
src/WebApi/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
|
||||
COPY . .
|
||||
RUN dotnet test
|
||||
|
||||
FROM build AS publish
|
||||
WORKDIR /src/WebApi
|
||||
RUN dotnet publish "WebApi.csproj" -c Release -o /app
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app .
|
||||
ENTRYPOINT ["dotnet", "WebApi.dll"]
|
@ -1,3 +0,0 @@
|
||||
pushd ..\WebApi\
|
||||
dotnet build
|
||||
popd
|
@ -1,3 +0,0 @@
|
||||
pushd ../WebApi/
|
||||
dotnet build
|
||||
popd
|
BIN
test/.DS_Store
vendored
BIN
test/.DS_Store
vendored
Binary file not shown.
@ -15,7 +15,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
|
@ -15,8 +15,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
|
@ -15,7 +15,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
|
Loading…
Reference in New Issue
Block a user