Skip to content

Commit

Permalink
update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaoHans committed Oct 28, 2024
1 parent 13974cc commit c79e98d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 41 deletions.
6 changes: 3 additions & 3 deletions samples/CRM.Blazor.Web/CRM.Blazor.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>CRM.Blazor.Web</RootNamespace>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<UserSecretsId>64c4627c-4e94-4b4f-97d8-49f7a3a2ce3d</UserSecretsId>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Logs\**" />
<Content Remove="Logs\**" />
<Content Include="..\..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
<EmbeddedResource Remove="Logs\**" />
<None Remove="Logs\**" />
</ItemGroup>
Expand All @@ -25,6 +24,7 @@
<ProjectReference Include="..\CRM.Aspire.ServiceDefaults\CRM.Aspire.ServiceDefaults.csproj" />
<ProjectReference Include="..\CRM.HttpApi\CRM.HttpApi.csproj" />
<ProjectReference Include="..\CRM.EntityFrameworkCore\CRM.EntityFrameworkCore.csproj" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<!--<PackageReference Include="AbpRadzen.Blazor.Server.UI" Version="0.0.7" />-->
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
Expand Down
14 changes: 8 additions & 6 deletions samples/CRM.Blazor.Web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
#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/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
Expand All @@ -16,16 +18,16 @@ COPY ["samples/CRM.Domain/CRM.Domain.csproj", "samples/CRM.Domain/"]
COPY ["samples/CRM.Aspire.ServiceDefaults/CRM.Aspire.ServiceDefaults.csproj", "samples/CRM.Aspire.ServiceDefaults/"]
COPY ["samples/CRM.HttpApi/CRM.HttpApi.csproj", "samples/CRM.HttpApi/"]
COPY ["samples/CRM.EntityFrameworkCore/CRM.EntityFrameworkCore.csproj", "samples/CRM.EntityFrameworkCore/"]
RUN dotnet restore "samples/CRM.Blazor.Web/CRM.Blazor.Web.csproj"
RUN dotnet restore "./samples/CRM.Blazor.Web/CRM.Blazor.Web.csproj"
COPY . .
WORKDIR "/src/samples/CRM.Blazor.Web"
RUN dotnet build "CRM.Blazor.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
RUN dotnet build "./CRM.Blazor.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "CRM.Blazor.Web.dll"]
ENTRYPOINT ["dotnet", "CRM.Blazor.Web.dll"]
75 changes: 43 additions & 32 deletions samples/CRM.Blazor.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:28922",
"sslPort": 44359
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5019",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7201;http://localhost:5019",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5019"
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7201;http://localhost:5019"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:28922",
"sslPort": 44359
}
}
}

0 comments on commit c79e98d

Please sign in to comment.