Dockerfile for .NET 5 applications

  .net-5, c#, digital-ocean, docker

I created the default REST API in NET 5 using Visual Studio 2019.

I added Dockerfile like below

# https://hub.docker.com/_/microsoft-dotnet-core
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY doma_api/*.csproj ./doma_api/
RUN dotnet restore

# copy everything else and build app
COPY doma_api/. ./doma_api/
WORKDIR /source/doma_api
RUN dotnet publish -c release -o /app --no-restore

# final stage/image
FROM mcr.microsoft.com/dotnet/sdk:5.0
WORKDIR /app
COPY --from=build /app ./
EXPOSE 80
ENTRYPOINT ["dotnet", "doma_api.dll"]

Deployment on Github which is related to DigitalOcean

Everything was fine during the build, but DEPLOY itself does not pass. It doesn’t show a specific error

Do I have any error in this file? Maybe the dll file name is invalid?

Build logs:
Pastebin link

Deploy logs:
Pastebin link

Source: Docker Questions

LEAVE A COMMENT