Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaoHans committed Oct 28, 2024
1 parent 73e5b4e commit 92e617f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
8 changes: 8 additions & 0 deletions samples/CRM.Blazor.Web/appsettings.Production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ConnectionStrings": {
"Default": "Host=postgre;Port=5432;Database=CRM;User ID=root;Password=2024@09$14&Start;"
},
"Redis": {
"Configuration": "redis"
}
}
3 changes: 3 additions & 0 deletions samples/CRM.DbMigrator/CRM.DbMigrator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="35.6.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
Expand Down
28 changes: 25 additions & 3 deletions samples/CRM.DbMigrator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/publish/ app/
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
USER app
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:80

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["samples/CRM.DbMigrator/CRM.DbMigrator.csproj", "samples/CRM.DbMigrator/"]
COPY ["samples/CRM.EntityFrameworkCore/CRM.EntityFrameworkCore.csproj", "samples/CRM.EntityFrameworkCore/"]
COPY ["samples/CRM.Domain/CRM.Domain.csproj", "samples/CRM.Domain/"]
COPY ["samples/CRM.Domain.Shared/CRM.Domain.Shared.csproj", "samples/CRM.Domain.Shared/"]
COPY ["samples/CRM.Application.Contracts/CRM.Application.Contracts.csproj", "samples/CRM.Application.Contracts/"]
RUN dotnet restore "./samples/CRM.DbMigrator/CRM.DbMigrator.csproj"
COPY . .
WORKDIR "/src/samples/CRM.DbMigrator"
RUN dotnet build "./CRM.DbMigrator.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./CRM.DbMigrator.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "CRM.DbMigrator.dll"]
10 changes: 10 additions & 0 deletions samples/CRM.DbMigrator/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"profiles": {
"CRM.DbMigrator": {
"commandName": "Project"
},
"Container (Dockerfile)": {
"commandName": "Docker"
}
}
}

0 comments on commit 92e617f

Please sign in to comment.