Skip to content

App does not have to be publised before Docker image add #42740

@deep-outcome

Description

@deep-outcome

Type of issue

Missing information

Description

From https://learn.microsoft.com/en-us/dotnet/core/docker/build-container?view=vs-2022&tabs=windows&pivots=dotnet-8-0#publish-net-app

Before adding the .NET app to the Docker image, first it must be published. It's best to have the container run the published version of the app.

This could be true but it is not for Dockefile used.

# Copy everything
COPY . ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out
…

These lines take care of building/publishing.

If this would be the case, then lines were be

# Copy everything
COPY . ./
# Build runtime imageCOPY --from=build-env App/bin/Release/net8.0/ .
…

Page URL

https://learn.microsoft.com/en-us/dotnet/core/docker/build-container?view=vs-2022&tabs=windows&pivots=dotnet-8-0

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/docker/build-container.md

Document Version Independent Id

58d57b81-4ca6-6536-8788-f212402b41a7

Article author

@IEvangelist

Metadata

  • ID: 4c7470d2-9a57-7654-e13a-4f912898f7aa
  • Service: dotnet-fundamentals
  • Sub-service: dotnet-docker

Related Issues


Associated WorkItem - 319943

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions