Popular blog tags

Part 3 - how to containerize a .NET Web application with Docker - using mcr.microsoft.com/dotnet/aspnet image

Published

Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:9.0@sha256:3fcf6f1e809c0553f9feb222369f58749af314af6f063f389cbd2f913b4ad556 AS build
WORKDIR /App

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

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:9.0@sha256:b4bea3a52a0a77317fa93c5bbdb076623f81e3e2f201078d89914da71318b5d8
WORKDIR /App
COPY --from=build /App/out .
ENTRYPOINT ["dotnet", "DotNet.Docker.dll"]

see:https://learn.microsoft.com/en-us/dotnet/core/docker/build-container?tabs=linux&pivots=dotnet-10-0#create-the-dockerfile

 

.NET's Docker Hub page

You can find a full list of all supported tags on .NET's Docker Hub page

https://hub.docker.com/r/microsoft/dotnet

https://github.com/dotnet/dotnet-docker/blob/main/README.aspnet.md