Skip to content

Disable UseAppHost in sample FDD Dockerfiles #3392

@mthalman

Description

@mthalman

The sample FDD Dockerfiles generated all use the following line:

RUN dotnet publish -c release -o /app --no-restore

This ends up outputting both an app executable and a library file in the output directory. See the publish documentation:

Publishing an app as framework-dependent produces a cross-platform binary as a dll file, and a platform-specific executable that targets your current platform.

Either file can be used to execute the app. The executable can be executed directly while the DLL requires the use of the .NET CLI (dotnet aspnetapp.dll). From an image size perspective, it seems wasteful to include both files in the output. Only one of them is actually needed in order to execute the app. The Dockerfile is configured to only make use of the DLL:

ENTRYPOINT ["dotnet", "aspnetapp.dll"]

So it seems reasonable to simply not include the executable in the output.

By configuring the UseAppHost property, the publish logic can be configured to not include the executable in the output.

I propose that the sample FDD Dockerfiles disable this property by default:

RUN dotnet publish -c release -o /app --no-restore /p:UseAppHost=false

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions